Skip to content

Commit

Permalink
docs(query): updated examples for updateOne and replaceOne
Browse files Browse the repository at this point in the history
fix #12706
  • Loading branch information
lpizzinidev committed Nov 20, 2022
1 parent c77dd1b commit afbd8d1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/query.js
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit afbd8d1

Please sign in to comment.