Update Methods更新方法
MongoDB provides the following methods for updating documents in a collection:MongoDB提供了以下方法来更新集合中的文档:
db.collection.updateOne() | |
db.collection.updateMany() | |
db.collection.replaceOne() |
Additional Methods其他方法
The following methods can also update documents from a collection:以下方法也可以更新集合中的文档:
db.collection.findOneAndReplace().db.collection.findOneAndUpdate().db.collection.findAndModify().db.collection.bulkWrite().
See the individual reference pages for the methods for more information and examples.有关方法的更多信息和示例,请参阅各个参考页。