On this page
WriteResult()
On this page
Definition
WriteResult
( )-
A wrapper that contains the result status of the
mongo
shell write methods.
Properties
The WriteResult
has the following properties:
WriteResult.
nInserted
-
The number of documents inserted, excluding
upserted
documents. SeeWriteResult.nUpserted
for 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.
$set
expression updates the value to the current value,nMatched
can 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,
nModified
can be less thannMatched
.
WriteResult.
nUpserted
-
The number of documents inserted by an upsert.
WriteResult.
_id
-
The
_id
of the document inserted by anupsert
. Returned only if anupsert
results in an insert.
WriteResult.
writeError
-
A document that contains information regarding any error, excluding write concern errors, encountered during the write operation.