What does mongoose's Model.updateOne return value mean?

Viewed 47

So my question is short and simple:
What do these describe?

{ n: 1, nModified: 1, ok: 1 }
1 Answers

See the Mongoose updateOne docs,

n; // Number of documents matched
nModified; // Number of documents modified
ok; // 1 if no errors occurred

You can also visit the MongoDB updateOne docs,

The method returns a document that contains:

matchedCount containing the number of matched documents
modifiedCount containing the number of modified documents
upsertedId containing the _id for the upserted document.
A boolean acknowledged as true if the operation ran with write concern or false if write concern was disabled

Related