mongodb findandmodify
const READ_DOCUMENTATION ;
https://docs.mongodb.com/manual/reference/command/findAndModify/#lasterrorobject
The lastErrorObject embedded document contains the following fields:
updatedExisting boolean
true if an update operation modified an existing document.
upserted document
Contains the ObjectId of the inserted document if an update operation with upsert: true resulted in a new document.
Value
For remove operations, value contains the removed document if the query matches a document. If the query does not match a document to remove, value contains null.
For update operations, the value embedded document contains the following:
If the new parameter is not set or is false:
the pre-modification document if the query matches a document;
otherwise, null.
If new is true:
the modified document if the query returns a match;
the inserted document if upsert: true and no document matches the query;
otherwise, null.