Skip to content

Conversation

@vkarpov15
Copy link
Collaborator

Summary

I needed to make a couple of small adjustments: no more noResponse option, and numbers are no longer valid as ObjectIds, but the rest seems to work.

Examples

Copy link
Contributor

Copilot AI left a 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 noResponse option from syncIndexes() calls, replaced with sparse option
  • 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.

vkarpov15 and others added 2 commits October 23, 2025 18:55
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Collaborator

@hasezoey hasezoey left a 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 });
Copy link
Collaborator

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.

Copy link
Collaborator

@AbdelrahmanHafez AbdelrahmanHafez left a 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 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants