Bson ObjectId object from the introduction, the object query string into use id:
from bson import ObjectId import pymongo conn = pymongo.MongoClient('mongodb://root:[email protected]/admin' str = "5sdfadsfasdfxzcasdfasdfas" findinfo = conn.db_name.table_name.find({"_id" : ObjectId(str)})