如何用pymongo计算OID范围的文档
我想计算它在625D8B0000000000000000和625EDC8000000000000000之间的文档 pymongo == 3.12.3 mongodb 3.2和4.4
我像打击一样写它: counter = Coll.Count_Documents({“ {” _ ID“:{“ $ in”:{“ $ oid”:“ 625D8B000000000000000000000000”},{“ $ oid”:“ 625EDC800000000000000000000000000000”}}}
)我们不会直接将OID与字符串进行比较。 它不起作用,我不知道它是什么rigt语法,请帮助!
i want to count the documents that it's oid between 625d8b000000000000000000 and 625edc800000000000000000
pymongo==3.12.3
mongodb 3.2 and 4.4
i write it like blow:counter = coll.count_documents({"_id" : {"$in" : { "$oid" : "625d8b000000000000000000" }, { "$oid" : "625edc800000000000000000" }}})
i guess that we coud't compare oid with string directly.
it does't work , i don't know what's it rigt syntax really, help pls!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅: https://pymongo.readthedocs.io.readthedocs.io oreadthedocs.io/en/stable/ api/bson/objectid.html
refer: https://pymongo.readthedocs.io/en/stable/api/bson/objectid.html