On this page
BulkWriteResult() has the following properties:
The number of existing documents selected for update or replacement. If the update/replacement operation results in no change to an existing document, e.g.
$setexpression updates the value to the current value,
nMatchedcan be greater than
The number of existing documents updated or replaced. If the update/replacement operation results in no change to an existing document, such as setting the value of the field to its current value,
nModifiedcan be less than
nMatched. Inserted documents do not affect the number of
nModified; refer to the
The number of documents removed.
The number of documents inserted through operations with the
An array of documents that contains information for each document inserted through operations with the
Each document contains the following information:
An integer that identifies the operation in the bulk operations list, which uses a zero-based index.
_idvalue of the inserted document.
An array of documents that contains information regarding any error, unrelated to write concerns, encountered during the update operation. The
writeErrorsarray contains an error document for each write operation that errors.
Each error document contains the following fields:
An integer that identifies the write operation in the bulk operations list, which uses a zero-based index. See also
An integer value identifying the error.
A description of the error.
A document identifying the operation that failed. For instance, an update/replace operation error will return a document specifying the query, the update, the
upsertoptions; an insert operation will return the document the operation tried to insert.
Document that describe error related to write concern and contains the field:
An integer value identifying the cause of the write concern error.
A description of the cause of the write concern error.
New in version 4.4.
The write concern object used for the corresponding operation. For information on write concern object fields, see Write Concern Specification.
The write concern object may also contain the following field, indicating the source of the write concern:
A string value indicating where the write concern originated (known as write concern
provenance). The following table shows the possible values for this field and their significance:ProvenanceDescription
clientSuppliedThe write concern was specified in the application.
customDefaultThe write concern originated from a custom defined default value. See
getLastErrorDefaultsThe write concern originated from the replica set's
implicitDefaultThe write concern originated from the server in absence of all other write concern specifications.