python - search by ObjectId in mongodb with pymongo -
i need search objectid python using pymongo error. ideas how search?
import pymongo pymongo import mongoclient 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> pymongo.connection import connection file "c:\python27\lib\site-packages\pymongo\connection.py", line 39, in <module> pymongo.mongo_client import mongoclient file "c:\python27\lib\site-packages\pymongo\mongo_client.py", line 45, in <module> pymongo import (auth, file "c:\python27\lib\site-packages\pymongo\database.py", line 22, in <module> pymongo.collection import collection file "c:\python27\lib\site-packages\pymongo\collection.py", line 25, in <module> pymongo.cursor import cursor file "c:\python27\lib\site-packages\pymongo\cursor.py", line 19, in <module> bson import re_type importerror: cannot import name re_type
i use pymongo 2.4.1.
from bson.objectid import objectid [i in dbm.neo_nodes.find({"_id": objectid(obj_id_to_find)})]
Comments
Post a Comment