更新文档主要有以下几种方法: db.collection.updateOne(filter, update, options) db.collection.updateMany(filter, update, options) db.collection.replaceOne(filter, update, options) 另外MongoDB提供了更新运算符,更加方便我们进行文档的更新.其使用方法如下: { update operator: { field1: value1, ... }, u…