Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@vkarpov15
Copy link
Collaborator

Fix #8862

Summary

The skipId parameter was taking up some prime real estate as the 3rd arg to new MyModel(), replace that with options. We already supported passing options, this PR just drops support for passing a boolean as 3rd arg to new MyModel().

Examples

@vkarpov15 vkarpov15 added this to the 9.0 milestone Sep 30, 2025
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 removes the deprecated skipId parameter from the Document() and Model() constructors, requiring the use of an options object instead. This is a breaking change that simplifies the API by eliminating parameter overloading where the third parameter could be either a boolean or an options object.

  • Removes support for passing skipId as a boolean third parameter to constructors
  • Updates all internal code to use { skipId: true } in options object instead
  • Adds error handling to prevent accidental usage of the old boolean parameter

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/document.js Core constructor changes to only accept options object and throw error for boolean usage
lib/model.js Updates Model constructor signature and documentation
lib/types/subdocument.js Removes skipId parameter handling logic
lib/types/arraySubdocument.js Updates Subdocument constructor call
lib/schema/subdocument.js Updates constructor calls to use options object
lib/queryHelpers.js Updates discriminator instantiation
lib/query.js Updates model instantiation for replaceOne
lib/helpers/model/castBulkWrite.js Updates model instantiation for bulk operations
test/document.test.js Formatting change to test constructor call
docs/migrating_to_9.md Adds migration documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@vkarpov15 vkarpov15 merged commit c867a04 into 9.0 Oct 2, 2025
66 of 67 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-8862 branch October 2, 2025 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants