2 / 2
Apr 15

I have the date store in db in datetime format and I used the pymongo to extract the data in json format and inserted into another collection from that json data. After inserting into the new collection, I am not able to query the data based on the date field in the new collection, it returns 0 docs.
Example document:
[{“_id”: ObjectId(“67f39c5c7c625e8f1ed5113c”),
“date”: ISODate(“2024-08-01T00:00:00Z”),}]
But able to query the data based on date in the old collection.

Any pointers, help on what could be the reason for this, much appreciated.
Thanks in advance.

  1. What query are you using on the new collection to find the document based on the date?
  2. What query were you using on the old collection to find the document based on the date?

Is that a document in the new collection or the old one? Provide examples of both.

Btw, you can also use Mongo Playground to provide working examples of the documents and the queries.