Skip to content

Commit 037a823

Browse files
authored
Merge pull request #14208 from Automattic/vkarpov15/gh-14207
docs: update findOneAndUpdate tutorial to use includeResultMetadata
2 parents 5b4a9c2 + c561c93 commit 037a823

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

docs/tutorials/findoneandupdate.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ However, there are some cases where you need to use [`findOneAndUpdate()`](https
66
* [Getting Started](#getting-started)
77
* [Atomic Updates](#atomic-updates)
88
* [Upsert](#upsert)
9-
* [The `rawResult` Option](#raw-result)
9+
* [The `includeResultMetadata` Option](#includeresultmetadata)
1010

1111
## Getting Started
1212

@@ -51,17 +51,17 @@ Using the `upsert` option, you can use `findOneAndUpdate()` as a find-and-[upser
5151
[require:Tutorial.*findOneAndUpdate.*upsert]
5252
```
5353

54-
<h2 id="raw-result">The `rawResult` Option</h2>
54+
<h2 id="includeresultmetadata">The <code>includeResultMetadata</code> Option<h2 id="rawresult"></h2></h2>
5555

5656
Mongoose transforms the result of `findOneAndUpdate()` by default: it
5757
returns the updated document. That makes it difficult to check whether
5858
a document was upserted or not. In order to get the updated document
5959
and check whether MongoDB upserted a new document in the same operation,
60-
you can set the `rawResult` flag to make Mongoose return the raw result
60+
you can set the `includeResultMetadata` flag to make Mongoose return the raw result
6161
from MongoDB.
6262

6363
```acquit
64-
[require:Tutorial.*findOneAndUpdate.*rawResult$]
64+
[require:Tutorial.*findOneAndUpdate.*includeResultMetadata$]
6565
```
6666

6767
Here's what the `res` object from the above example looks like:

test/model.findOneAndUpdate.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,6 @@ describe('model: findOneAndUpdate:', function() {
13341334
const opts = {
13351335
new: true,
13361336
upsert: false,
1337-
passRawResult: false,
13381337
overwrite: false,
13391338
runValidators: true
13401339
};

0 commit comments

Comments
 (0)