- Reference >
- mongo Shell Methods >
- Object Constructors and Methods >
- BulkWriteResult()
BulkWriteResult()¶
On this page
- BulkWriteResult()¶
New in version 2.6.
A wrapper that contains the results of the Bulk.execute() method.
Properties¶
The BulkWriteResult has the following properties:
- BulkWriteResult.nInserted¶
The number of documents inserted using the Bulk.insert() method. For documents inserted through operations with the Bulk.find.upsert() option, see the nUpserted field instead.
- BulkWriteResult.nMatched¶
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. $set expression updates the value to the current value, nMatched can be greater than nModified.
- BulkWriteResult.nModified¶
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, nModified can be less than nMatched. Inserted documents do not affect the number of nModified; refer to the nInserted and nUpserted fields instead.
- BulkWriteResult.nRemoved¶
The number of documents removed.
- BulkWriteResult.nUpserted¶
The number of documents inserted through operations with the Bulk.find.upsert() option.
- BulkWriteResult.upserted¶
An array of documents that contains information for each document inserted through operations with the Bulk.find.upsert() option.
Each document contains the following information:
- BulkWriteResult.upserted.index¶
An integer that identifies the operation in the bulk operations list, which uses a zero-based index.
- BulkWriteResult.upserted._id¶
The _id value of the inserted document.
- BulkWriteResult.writeErrors¶
An array of documents that contains information regarding any error, unrelated to write concerns, encountered during the update operation. The writeErrors array contains an error document for each write operation that errors.
Each error document contains the following fields:
- BulkWriteResult.writeErrors.index¶
An integer that identifies the write operation in the bulk operations list, which uses a zero-based index. See also Bulk.getOperations().
- BulkWriteResult.writeErrors.code¶
An integer value identifying the error.
- BulkWriteResult.writeErrors.errmsg¶
A description of the error.
- BulkWriteResult.writeErrors.op¶
A document identifying the operation that failed. For instance, an update/replace operation error will return a document specifying the query, the update, the multi and the upsert options; an insert operation will return the document the operation tried to insert.
- BulkWriteResult.writeConcernError¶
Document that describe error related to write concern and contains the field:
- BulkWriteResult.writeConcernError.code¶
An integer value identifying the cause of the write concern error.
- BulkWriteResult.writeConcernError.errInfo¶
A document identifying the write concern setting related to the error.
- BulkWriteResult.writeConcernError.errmsg¶
A description of the cause of the write concern error.
Thank you for your feedback!
We're sorry! You can Report a Problem to help us improve this page.