age:22}]})
# or 条件查询
# 查询 name='lisi' 或者 age=11 的
db.user_info.find({$or: [{name:'lisi'},{age:11}]})...4.2 in & all
# in
# field 是 查询条件的子集
# 查询 age 在 11,22,44 里面的
# db.user_info.find({age:{$in: [11,22,44]...}})
# all
# 查询条件是 field 的子集
# 查询 1,2,3 三个数字同时是哪些人喜欢的数字
# db.user_info.find({favourite_num:{$all: [1,2,3...sort
其次优先为 skip
最低优先级 limit
6.pymongo 对 MongoDB 的增删改查
6.1创建连接
import pymongo
# 根据 str 类型的 ObjectId...查询数据
from bson import ObjectId
# 创建连接
mongo_conn = pymongo.MongoClient(host='localhost', port=27017)