Skip to content

Commit

Permalink
Merge pull request #13733 from Automattic/vkarpov15/gh-12671-2
Browse files Browse the repository at this point in the history
docs(migrating_to_6): add note about incompatible packages
  • Loading branch information
vkarpov15 authored Aug 15, 2023
2 parents 75479a4 + 4dc3233 commit a08e10c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/migrating_to_6.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ If you're still on Mongoose 4.x, please read the [Mongoose 4.x to 5.x migration
* [`toObject()` and `toJSON()` Use Nested Schema `minimize`](#toobject-and-tojson-use-nested-schema-minimize)
* [TypeScript changes](#typescript-changes)
* [Removed `reconnectTries` and `reconnectInterval` options](#removed-reconnecttries-and-reconnectinterval-options)
* [MongoDB Driver's New URL Parser Incompatible with Some npm Packages](#mongodb-drivers-new-url-parser-incompatible-with-some-npm-packages)

<h2 id="version-requirements"><a href="#version-requirements">Version Requirements</a></h2>

Expand Down Expand Up @@ -497,6 +498,12 @@ In Mongoose 6, populating a path with no `ref`, `refPath`, or `model` is a no-op
await Test.findOne().populate('parents');
```

<h2 id="mongodb-drivers-new-url-parser-incompatible-with-some-npm-packages"><a href="#mongodb-drivers-new-url-parser-incompatible-with-some-npm-packages">MongoDB Driver's New URL Parser Incompatible with Some npm Packages</a></h2>

The MongoDB Node driver version that Mongoose 6 uses relies on a [URL parser module](https://npmjs.com/package/whatwg-url) that has several known compatibility issues with other npm packages.
This can lead to errors like `Invalid URL: mongodb+srv://username:password@development.xyz.mongodb.net/abc` if you use one of the incompatible packages.
[You can find a list of incompatible packages here](https://mongoosejs.com/docs/incompatible_packages).

## TypeScript changes

The `Schema` class now takes 3 generic params instead of 4. The 3rd generic param, `SchemaDefinitionType`, is now the same as the 1st generic param `DocType`. Replace `new Schema<UserDocument, UserModel, User>(schemaDefinition)` with `new Schema<UserDocument, UserModel>(schemaDefinition)`
Expand Down

0 comments on commit a08e10c

Please sign in to comment.