【python】mongo删除数据

参考:https://stackoverflow.com/questions/23334743/setting-justone-limiter-for-pymongo-remove-throws-typeerror

 

正确的写法:

collection.remove({"_id":earliest_id_date["_id"]})

ufo.users.remove({'emails.address': 'foo@bar.com'}, safe=True)

 

 

下面这个写法会报错:

collection.remove({"_id":earliest_id_date["_id"]}, 1)

后面不能写1,会报错raise TypeError("Wrong type for %s, value must be a boolean" % (option,))

posted @ 2017-07-24 15:39  匡子语  阅读(909)  评论(0编辑  收藏  举报