- Reference >
mongoShell Methods >- Object Constructors and Methods >
- WriteResult()
WriteResult()¶
On this page
Definition¶
Properties¶
The WriteResult has the following properties:
-
WriteResult.nInserted¶ The number of documents inserted, excluding
upserteddocuments. SeeWriteResult.nUpsertedfor the number of documents inserted through an upsert.
-
WriteResult.nMatched¶ The number of documents selected for update. If the update operation results in no change to the document, e.g.
$setexpression updates the value to the current value,nMatchedcan be greater thannModified.
-
WriteResult.nModified¶ The number of existing documents updated. If the update/replacement operation results in no change to the document, such as setting the value of the field to its current value,
nModifiedcan be less thannMatched.
-
WriteResult._id¶ The
_idof the document inserted by anupsert. Returned only if anupsertresults in an insert.
-
WriteResult.nRemoved¶ The number of documents removed.
-
WriteResult.writeError¶ A document that contains information regarding any error, excluding write concern errors, encountered during the write operation.
-
WriteResult.writeError.code¶ An integer value identifying the error.
-
WriteResult.writeError.errmsg¶ A description of the error.
-
-
WriteResult.writeConcernError¶ A document that contains information regarding any write concern errors encountered during the write operation.
-
WriteResult.writeConcernError.code¶ An integer value identifying the write concern error.
-
WriteResult.writeConcernError.errInfo¶ A document identifying the write concern setting related to the error.
-
WriteResult.writeConcernError.errmsg¶ A description of the error.
-