0
votes

Lots of solutions to querying mongoDB using date/time field in MongoDB but what if the mongo doc doesn't have a date/time field?

I've noticed that when I hover the mouse over a document _id (using NoSQLBooster for MongoDB) I get a "createdAt" dropdown (see screenshot below). Just wondering if there is anyway to do a query using pymongo where documents are filtered based on a date/time range using their "createdAt" metadata?

screen shot of createdAt metadata

1

1 Answers

0
votes

In MongoDB the id of the docs contains the timestamp of creation, this is mentioned on this other question. You can make a script that insert a date/field using this information to perform those queries or perform the query directly to using the objectId as in here.