pymongo find $in 的使用 python mongodb
笔者近日需要用到mongoDB的$in,查询了一下在Python中该如何查询:
import pymongo
client = pymongo.MongoClient('host', 0000) # 0000 即IP
db = client.so
coll = db.speciesCollection
result = coll.find({"SPCOMNAME":{"$in":['paddlefish','lake sturgeon']}})
for doc in result:
print(doc)
参考了:https://stackoverflow.com/questions/38919756/pymongo-in-query-not-working