On this page本页内容
Tip
Starting in version 3.2, MongoDB also provides the 从3.2版开始,MongoDB还提供了db.collection.bulkWrite() method for performing bulk write operations.db.collection.bulkWrite()方法来执行批量写入操作。
Bulk.find.replaceOne(<document>)¶Adds a single document replacement operation to a bulk operations list. 将单个文档替换操作添加到批量操作列表中。Use the 使用Bulk.find() method to specify the condition that determines which document to replace. Bulk.find()方法指定决定替换哪个文档的条件。The Bulk.find.replaceOne() method limits the replacement to a single document.Bulk.find.replaceOne()方法将替换限制为单个文档。
Bulk.find.replaceOne() accepts the following parameter:接受以下参数:
replacement |
document |
|
To specify an upsert for this operation, see 要为此操作指定upsert,请参阅Bulk.find.upsert().Bulk.find.upsert()。
To specify the index to use for the associated 要指定用于关联Bulk.find(), see Bulk.find.hint().Bulk.find()的索引,请参阅Bulk.find.hint()。
The following example initializes a 以下示例初始化Bulk() operations builder for the items collection, and adds various replaceOne operations to the list of operations.items集合的Bulk()操作生成器,并将各种replaceOne操作添加到操作列表中。