Skip to content

Commit ccf4ffa

Browse files
authored
Merge pull request Automattic#14957 from Automattic/vkarpov15/Automatticgh-14951
docs(model): add more info on acknowledged: false, specifically that Mongoose may return that if the update was empty
2 parents f34935d + b7f33e7 commit ccf4ffa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/model.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3771,7 +3771,7 @@ Model.hydrate = function(obj, projection, options) {
37713771
* const res = await Person.updateMany({ name: /Stark$/ }, { isDeleted: true });
37723772
* res.matchedCount; // Number of documents matched
37733773
* res.modifiedCount; // Number of documents modified
3774-
* res.acknowledged; // Boolean indicating everything went smoothly.
3774+
* 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.
37753775
* res.upsertedId; // null or an id containing a document that had to be upserted.
37763776
* res.upsertedCount; // Number indicating how many documents had to be upserted. Will either be 0 or 1.
37773777
*
@@ -3811,7 +3811,7 @@ Model.updateMany = function updateMany(conditions, doc, options) {
38113811
* const res = await Person.updateOne({ name: 'Jean-Luc Picard' }, { ship: 'USS Enterprise' });
38123812
* res.matchedCount; // Number of documents matched
38133813
* res.modifiedCount; // Number of documents modified
3814-
* res.acknowledged; // Boolean indicating everything went smoothly.
3814+
* 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.
38153815
* res.upsertedId; // null or an id containing a document that had to be upserted.
38163816
* res.upsertedCount; // Number indicating how many documents had to be upserted. Will either be 0 or 1.
38173817
*
@@ -3849,7 +3849,7 @@ Model.updateOne = function updateOne(conditions, doc, options) {
38493849
* const res = await Person.replaceOne({ _id: 24601 }, { name: 'Jean Valjean' });
38503850
* res.matchedCount; // Number of documents matched
38513851
* res.modifiedCount; // Number of documents modified
3852-
* res.acknowledged; // Boolean indicating everything went smoothly.
3852+
* res.acknowledged; // Boolean indicating the MongoDB server received the operation.
38533853
* res.upsertedId; // null or an id containing a document that had to be upserted.
38543854
* res.upsertedCount; // Number indicating how many documents had to be upserted. Will either be 0 or 1.
38553855
*

0 commit comments

Comments
 (0)