Skip to content

Commit

Permalink
Merge pull request #14957 from Automattic/vkarpov15/gh-14951
Browse files Browse the repository at this point in the history
docs(model): add more info on acknowledged: false, specifically that Mongoose may return that if the update was empty
  • Loading branch information
vkarpov15 authored Oct 14, 2024
2 parents f34935d + b7f33e7 commit ccf4ffa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -3771,7 +3771,7 @@ Model.hydrate = function(obj, projection, options) {
* const res = await Person.updateMany({ name: /Stark$/ }, { isDeleted: true });
* res.matchedCount; // Number of documents matched
* res.modifiedCount; // Number of documents modified
* res.acknowledged; // Boolean indicating everything went smoothly.
* res.acknowledged; // Boolean indicating the MongoDB server received the operation. This may be false if Mongoose did not send an update to the server because the update was empty.
* res.upsertedId; // null or an id containing a document that had to be upserted.
* res.upsertedCount; // Number indicating how many documents had to be upserted. Will either be 0 or 1.
*
Expand Down Expand Up @@ -3811,7 +3811,7 @@ Model.updateMany = function updateMany(conditions, doc, options) {
* const res = await Person.updateOne({ name: 'Jean-Luc Picard' }, { ship: 'USS Enterprise' });
* res.matchedCount; // Number of documents matched
* res.modifiedCount; // Number of documents modified
* res.acknowledged; // Boolean indicating everything went smoothly.
* res.acknowledged; // Boolean indicating the MongoDB server received the operation. This may be false if Mongoose did not send an update to the server because the update was empty.
* res.upsertedId; // null or an id containing a document that had to be upserted.
* res.upsertedCount; // Number indicating how many documents had to be upserted. Will either be 0 or 1.
*
Expand Down Expand Up @@ -3849,7 +3849,7 @@ Model.updateOne = function updateOne(conditions, doc, options) {
* const res = await Person.replaceOne({ _id: 24601 }, { name: 'Jean Valjean' });
* res.matchedCount; // Number of documents matched
* res.modifiedCount; // Number of documents modified
* res.acknowledged; // Boolean indicating everything went smoothly.
* res.acknowledged; // Boolean indicating the MongoDB server received the operation.
* res.upsertedId; // null or an id containing a document that had to be upserted.
* res.upsertedCount; // Number indicating how many documents had to be upserted. Will either be 0 or 1.
*
Expand Down

0 comments on commit ccf4ffa

Please sign in to comment.