Skip to content

Commit

Permalink
Update migrating_to_7.md
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Apr 20, 2023
1 parent d9c8bf4 commit 0fde106
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/migrating_to_7.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you're still on Mongoose 5.x, please read the [Mongoose 5.x to 6.x migration
* [Removed `castForQueryWrapper()`, updated `castForQuery()` signature](#removed-castforquerywrapper)
* [Copy schema options in `Schema.prototype.add()`](#copy-schema-options-in-schema-prototype-add)
* [ObjectId bsontype now has lowercase d](#objectid-bsontype-now-has-lowercase-d)
* [No more support for custom promise libraries](#removed-custom-promise)
* [Removed support for custom promise libraries](#removed-support-for-custom-promise-libraries)
* [TypeScript-specific changes](#typescript-specific-changes)
* [Removed `LeanDocument` and support for `extends Document`](#removed-leandocument-and-support-for-extends-document)
* [New parameters for `HydratedDocument`](#new-parameters-for-hydrateddocument)
Expand Down Expand Up @@ -253,21 +253,21 @@ oid._bsontype; // 'ObjectId' in Mongoose 7, 'ObjectID' in older versions of Mong
Please update any places where you use `_bsontype` to check if an object is an ObjectId.
This may also affect libraries that use Mongoose.

<h2 id="removed-custom-promise"><a href="#removed-custom-promies">Removed Support for custom promise libraries</a></h2>
<h2 id="removed-support-for-custom-promise-libraries"><a href="#removed-support-for-custom-promise-libraries">Removed Support for custom promise libraries</a></h2>

Mongoose 7 no longer includes support for custom promise libraries. So now the following does not work.
Mongoose 7 no longer supports plugging in custom promise libraries. So the following no longer makes Mongoose return Bluebird promises in Mongoose 7.

```javascript
const mongoose = require('mongoose');

// No-op on Mongoose 7
mongoose.Promise = require('bluebird');
```

However, should this change be a dealbreaker for you to upgrade,
the following is a workaround.
If you want to use Bluebird for all promises globally, you can do the following:

```javascript
global.Promise = YourCustomPromise;
global.Promise = require('bluebird');
```

<h2 id="typescript-specific-changes"><a href="#typescript-specific-changes">TypeScript-specific Changes</a></h2>
Expand Down

0 comments on commit 0fde106

Please sign in to comment.