On this page本页内容
Tip
Starting in version 3.2, MongoDB also provides the db.collection.bulkWrite()
method for performing bulk write operations.
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. The Bulk.find.replaceOne()
method limits the replacement to a single document.
Bulk.find.replaceOne()
accepts the following parameter:
replacement |
document | A replacement document that completely replaces the existing document. Contains only field and value pairs. The sum of the associated |
To specify an upsert for this operation, see Bulk.find.upsert()
.
To specify the index to use for the associated Bulk.find()
, see 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.