0

$match aggregation is giving me None (in terms of Python) even though I have verified it multiple time entries are present in DB . In Python pymongo is not recognizing the ISO while I write inside the cursor = {} making ISO as string and concatenating it with the time also doesn't work it gives the empty list . same case with all operator gte or lte .

db.cityhistory.find({"updateTime": ISODate("2018-04-20T13:27:39.021+0000"), "countries.city": {"$exists": true}}, {"countries.city": 1})

  • db.cityhistory.aggregate([ { "$project": {"countries.city": 1} }, { "$match": {"updateTime": {"eq":("2018-04-20T19:57:30.000+0000")} } }, { "$unwind": "$countries.city" }, { "$group": { "_id": "result", "count": {"$sum": 1} } } ]) – Prashant Sharma Apr 20 '18 at 20:36
  • *" pymongo is not recognizing the ISO"* That's because when you actually **read** the marked duplicate instead of complaining, then you will see that you use the `datetime` module for dates when working with python. – Neil Lunn Apr 21 '18 at 22:23

0 Answers0