diff --git a/docs/tutorials/findoneandupdate.md b/docs/tutorials/findoneandupdate.md index c589b15b952..80f99fff4da 100644 --- a/docs/tutorials/findoneandupdate.md +++ b/docs/tutorials/findoneandupdate.md @@ -6,7 +6,7 @@ However, there are some cases where you need to use [`findOneAndUpdate()`](https * [Getting Started](#getting-started) * [Atomic Updates](#atomic-updates) * [Upsert](#upsert) -* [The `rawResult` Option](#raw-result) +* [The `includeResultMetadata` Option](#includeresultmetadata) ## Getting Started @@ -51,17 +51,17 @@ Using the `upsert` option, you can use `findOneAndUpdate()` as a find-and-[upser [require:Tutorial.*findOneAndUpdate.*upsert] ``` -

The `rawResult` Option

+

The includeResultMetadata Option

Mongoose transforms the result of `findOneAndUpdate()` by default: it returns the updated document. That makes it difficult to check whether a document was upserted or not. In order to get the updated document and check whether MongoDB upserted a new document in the same operation, -you can set the `rawResult` flag to make Mongoose return the raw result +you can set the `includeResultMetadata` flag to make Mongoose return the raw result from MongoDB. ```acquit -[require:Tutorial.*findOneAndUpdate.*rawResult$] +[require:Tutorial.*findOneAndUpdate.*includeResultMetadata$] ``` Here's what the `res` object from the above example looks like: diff --git a/test/model.findOneAndUpdate.test.js b/test/model.findOneAndUpdate.test.js index 56ac556eb6c..55a1f48ac8a 100644 --- a/test/model.findOneAndUpdate.test.js +++ b/test/model.findOneAndUpdate.test.js @@ -1334,7 +1334,6 @@ describe('model: findOneAndUpdate:', function() { const opts = { new: true, upsert: false, - passRawResult: false, overwrite: false, runValidators: true };