[英]Pymongo multi update query
I have the following query 我有以下查询
DB_HOST = '127.0.0.1'
COLLECTION = 'scraper'
db = pymongo.MongoClient(DB_HOST)[COLLECTION]['scrap']
db.update({'indice':0, 'thread_id':{'$in':list_to_update}},{'updated':'yes'}, multi=True)
where list_to_update is a list of thread_ids where I would like to insert the field 'updated' to 'yes' 其中list_to_update是一个thread_ids列表,我想将'updated'字段插入'yes'
I am receiving the following error 我收到以下错误
pymongo.errors.OperationFailure: multi update only works with $ operators
Any ideas? 有任何想法吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.