Skip to content

Commit be6a2c8

Browse files
committed
docs(deprecations): update deprecations for Mongoose 9 - no active deprecations
1 parent fb713b2 commit be6a2c8

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed

docs/deprecations.md

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,3 @@
11
# Deprecation Warnings
22

3-
There are several deprecations in the [MongoDB Node.js driver](http://npmjs.com/package/mongodb)
4-
that Mongoose users should be aware of. Mongoose provides options to work
5-
around these deprecation warnings, but you need to test whether these options
6-
cause any problems for your application. Please [report any issues on GitHub](https://github.com/Automattic/mongoose/issues/new).
7-
8-
## Summary {#summary}
9-
10-
To fix all deprecation warnings, follow the below steps:
11-
12-
* Replace `rawResult: true` with `includeResultMetadata: true` in `findOneAndUpdate()`, `findOneAndReplace()`, `findOneAndDelete()` calls.
13-
14-
Read below for more a more detailed description of each deprecation warning.
15-
16-
## `rawResult` {#rawresult}
17-
18-
As of Mongoose 7.4.0, the `rawResult` option to `findOneAndUpdate()` is deprecated.
19-
You should instead use the `includeResultMetadata` option, which the MongoDB Node.js driver's new option that replaces `rawResult`.
20-
21-
```javascript
22-
// Replace this:
23-
const doc = await Test.findOneAndUpdate(
24-
{ name: 'Test' },
25-
{ name: 'Test Testerson' },
26-
{ rawResult: true }
27-
);
28-
29-
// With this:
30-
const doc = await Test.findOneAndUpdate(
31-
{ name: 'Test' },
32-
{ name: 'Test Testerson' },
33-
{ includeResultMetadata: true }
34-
);
35-
```
36-
37-
The `rawResult` option only affects Mongoose; the MongoDB Node.js driver still returns the full result metadata, Mongoose just parses out the raw document.
38-
The `includeResultMetadata` option also tells the MongoDB Node.js driver to only return the document, not the full `ModifyResult` object.
3+
There are no current deprecation warnings for Mongoose 9.x.

0 commit comments

Comments
 (0)