-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
upgrade to pre-release of mongodb node driver 7 #15697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 9.0
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR upgrades Mongoose to use a pre-release version of the MongoDB Node.js driver v7. The main changes involve removing the deprecated noResponse option and adjusting behavior around ObjectId validation and creation with numbers.
- Updated mongodb driver dependency to pre-release version 7
- Removed
noResponseoption fromsyncIndexes()calls, replaced withsparseoption - Updated ObjectId validation to reject numbers as valid ObjectIds
- Added migration guide documentation for breaking changes
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| package.json | Updates mongodb driver dependency to v7 pre-release version |
| test/types/models.test.ts | Removes noResponse option from syncIndexes() test cases |
| test/types/base.test.ts | Removes noResponse option from syncIndexes() test cases |
| test/model.query.casting.test.js | Updates ObjectId creation to use string format instead of numbers |
| test/index.test.js | Changes test assertion to expect isValidObjectId() to return false for numbers |
| docs/migrating_to_9.md | Adds documentation for ObjectId validation breaking change |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me aside from the 2 failing tests.
| function gh12100() { | ||
| mongoose.syncIndexes({ continueOnError: true, noResponse: true }); | ||
| mongoose.syncIndexes({ continueOnError: false, noResponse: true }); | ||
| mongoose.syncIndexes({ continueOnError: true, sparse: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should likely be in the migration guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the comment from @hasezoey, LGTM 👍
Summary
I needed to make a couple of small adjustments: no more
noResponseoption, and numbers are no longer valid as ObjectIds, but the rest seems to work.Examples