Skip to content
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

feat(NODE-6252): insertMany and bulkWrite permit readonly arrays #4175

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Jul 15, 2024

Description

What is changing?

  • insertMany and bulkWrite on the Collection class accept readonly arrays
Is there new documentation needed for these changes?

No

What is the motivation for this change?

Readonly data structures in TS can be narrowed and index checked, improving DX.

Release Highlight

insertMany and bulkWrite accept ReadonlyArray inputs

This improves the typescript developer expirence, developers tend to use ReadonlyArray because it can help understand where mutations are made and when enabling noUncheckedIndexedAccess leads to a better type narrowing expirence.

Please note, that the array is readonly but not the documents, the driver adds _id fields to your documents unless you request that the server generate the _id with forceServerObjectId

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@baileympearson baileympearson self-assigned this Jul 15, 2024
@baileympearson baileympearson added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jul 15, 2024
@baileympearson baileympearson merged commit 4b219d3 into main Jul 15, 2024
26 of 29 checks passed
@baileympearson baileympearson deleted the NODE-6252-readonly-array branch July 15, 2024 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Primary Review In Review with primary reviewer, not yet ready for team's eyes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants