BulkWriteResult()
BulkWriteResult()
A wrapper that contains the results of the
Bulk.execute()
method.
Properties
BulkWriteResult
has the following properties:
writeErrors Exception
If there is a write error while processing the bulk write,
mongosh
raises an exception that contains a writeErrors
property with the following fields:
writeErrors
An array of documents that contains information regarding any error, unrelated to write concerns, encountered during the update operation.
writeErrors
contains an error document for each write operation that errors.Each error document contains the following fields:
writeErrors.index
Integer that identifies the write operation in the bulk operations list, which uses a zero-based index. See also
Bulk.getOperations()
.
writeConcernError Exception
If there is a write concern error while processing the bulk write,
mongosh
raises an exception that contains a writeConcernError
property with the following fields:
writeConcernError
Document describing errors that relate to the write concern.
Changed in version 7.1: When
BulkWriteResult()
is received frommongos
, write concern errors are always reported, even when one or more write errors occur.In previous releases, the occurrence of write errors could cause the
BulkWriteResult()
to not report write concern errors.The
writeConcernError
documents contains the following fields:writeConcernError.errInfo.writeConcern
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:
writeConcernError.errInfo.writeConcern.provenance
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:ProvenanceDescriptionclientSupplied
The write concern was specified in the application.customDefault
The write concern originated from a custom defined default value. SeesetDefaultRWConcern
.getLastErrorDefaults
The write concern originated from the replica set'ssettings.getLastErrorDefaults
field.implicitDefault
The write concern originated from the server in absence of all other write concern specifications.