From afbd8d1c29ad585b83a13b428696ecdaa057f5bc Mon Sep 17 00:00:00 2001 From: Luca Pizzini Date: Sun, 20 Nov 2022 11:24:08 +0100 Subject: [PATCH] docs(query): updated examples for updateOne and replaceOne fix #12706 --- lib/query.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/query.js b/lib/query.js index 30e85f7985b..7dc1f8bbc20 100644 --- a/lib/query.js +++ b/lib/query.js @@ -4574,8 +4574,11 @@ Query.prototype.updateMany = function(conditions, doc, options, callback) { * #### Example: * * const res = await Person.updateOne({ name: 'Jean-Luc Picard' }, { ship: 'USS Enterprise' }); - * res.n; // Number of documents matched - * res.nModified; // Number of documents modified + * res.acknowledged; // Indicates if this write result was acknowledged. If not, then all other members of this result will be undefined. + * res.matchedCount; // Number of documents that matched the filter + * res.modifiedCount; // Number of documents that were modified + * res.upsertedCount; // Number of documents that were upserted + * res.upsertedId; // Identifier of the inserted document (if an upsert took place) * * This function triggers the following middleware. * @@ -4638,8 +4641,11 @@ Query.prototype.updateOne = function(conditions, doc, options, callback) { * #### Example: * * const res = await Person.replaceOne({ _id: 24601 }, { name: 'Jean Valjean' }); - * res.n; // Number of documents matched - * res.nModified; // Number of documents modified + * res.acknowledged; // Indicates if this write result was acknowledged. If not, then all other members of this result will be undefined. + * res.matchedCount; // Number of documents that matched the filter + * res.modifiedCount; // Number of documents that were modified + * res.upsertedCount; // Number of documents that were upserted + * res.upsertedId; // Identifier of the inserted document (if an upsert took place) * * This function triggers the following middleware. *