1
用pymongo在mongodb中按ObjectId搜索
我需要使用pymongo用python搜索ObjectId,但是我总是会收到此错误。有什么想法如何搜索? import pymongo from pymongo import MongoClient from pymongo import ObjectId gate = collection.find({'_id': ObjectId(modem["dis_imei"])}) print gate Traceback (most recent call last): File "C:\Users\gerswin\Documents\Proyectos\Demonio py\test.py", line 2, in <module> import pymongo File "C:\Python27\lib\site-packages\pymongo\__init__.py", line 80, in <module> from pymongo.connection import Connection File "C:\Python27\lib\site-packages\pymongo\connection.py", line 39, in <module> from pymongo.mongo_client import …