search by ObjectId in mongodb with pymongo

前端 未结 1 1022
耶瑟儿~
耶瑟儿~ 2020-11-27 03:31

I need to search an ObjectId with python using pymongo but I always get this error. Any ideas how to search?

import pymongo
from pymongo import MongoClient
         


        
相关标签:
1条回答
  • 2020-11-27 03:59

    I use pymongo 2.4.1.

    from bson.objectid import ObjectId
    [i for i in dbm.neo_nodes.find({"_id": ObjectId(obj_id_to_find)})]
    
    0 讨论(0)
提交回复
热议问题