From e9c826cc1769bffe13b6a07a8ea1388555b3179a Mon Sep 17 00:00:00 2001 From: Hafez Date: Fri, 15 May 2020 07:16:33 +0200 Subject: [PATCH] docs(document): elaborate on how Document#save works re #9001 --- lib/document.js | 3 ++- lib/model.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/document.js b/lib/document.js index dce56008b3d..f59a1bb617e 100644 --- a/lib/document.js +++ b/lib/document.js @@ -2606,7 +2606,8 @@ Document.prototype.$markValid = function(path) { }; /** - * Saves this document. + * Saves this document by inserting a new document into the database if [document.isNew](/docs/api.html#document_Document-isNew) is `true`, + * or sends an [updateOne](/docs/api.html#document_Document-updateOne) operation **only** with the modifications to the database, it does not replace the whole document in the latter case. * * ####Example: * diff --git a/lib/model.js b/lib/model.js index cc9a7851232..784cfeb3683 100644 --- a/lib/model.js +++ b/lib/model.js @@ -415,7 +415,8 @@ function generateVersionError(doc, modifiedPaths) { } /** - * Saves this document. + * Saves this document by inserting a new document into the database if [document.isNew](/docs/api.html#document_Document-isNew) is `true`, + * or sends an [updateOne](/docs/api.html#document_Document-updateOne) operation **only** with the modifications to the database, it does not replace the whole document in the latter case. * * ####Example: *