使用PyMongo,我在一个列表中有一组dict,我想提交给我的MongoDB.列表中的一些项目是新条目,一些是要更新的.
例子:
On Server Database:
[{"_id" : 1, "foo" : "bar}]
To send to database:
[{"_id" : 1, "foo" : "HELLO"}, {"_id" : 2, "Blah" : "Bloh"}]
我目前正在使用以下方法插入文档,但我将如何执行上述操作?感谢您的帮助!
collection.insert(myDict)