- Reference >
mongoShell Methods >- Bulk Operation Methods >
- Bulk.find.updateOne()
Bulk.find.updateOne()¶
On this page
Tip
Starting in version 3.2, MongoDB also provides the
db.collection.bulkWrite() method for performing bulk
write operations.
Description¶
-
Bulk.find.updateOne(<update>)¶ New in version 2.6.
Adds a single document update operation to a bulk operations list.
Use the
Bulk.find()method to specify the condition that determines which document to update. TheBulk.find.updateOne()method limits the update to a single document. To update multiple documents, seeBulk.find.update().Bulk.find.updateOne()accepts the following parameter:Parameter Type Description updatedocument An update document that specifies the modifications to make. Specify the modifications with update operator expressions.
The sum of the associated
<query>document from theBulk.find()and the update document must be less than or equal to themaximum BSON document size.To specify an upsert: true for this operation, see
Bulk.find.upsert(). To replace a document wholesale, seeBulk.find.replaceOne().
Behavior¶
If the <update> document contains only update operator expressions, as in:
Then, Bulk.find.updateOne() updates only the corresponding
fields, status and points, in the document.