【发布时间】:2022-03-29 19:09:02
【问题描述】:
我有一个在 mongo shell 中工作的 mongodb 查询:
db.collection.find({ created_at: { $gte : ISODate("2015-03-01T00:00:00.000Z"), $lt : ISODate("2015-03-30T00:00:00.00Z") } })
我正在尝试以下 pymongo:
test_range = agents.coll.find({ "created_at" : { "$gte" : "ISODate('2015-03-01T00:00:00.000Z')", "$lt" : "ISODate('2015-03-30T00:00:00.00Z')" } })
我收到SyntaxError: invalid syntax
在 pymongo 查询中处理 ISODate 的正确方法是什么?
【问题讨论】: