标签:cas inf roo 字符串 from color 查询 info client
从bson中导入ObjectId对象,将字符串转换成id对象查询使用:
from bson import ObjectId import pymongo conn = pymongo.MongoClient(‘mongodb://root:abc123@127.0.0.1/admin‘ str = "5sdfadsfasdfxzcasdfasdfas" findinfo = conn.db_name.table_name.find({"_id" : ObjectId(str)})
标签:cas inf roo 字符串 from color 查询 info client
原文地址:https://www.cnblogs.com/frisk/p/11568402.html