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

fix(NODE-3344): allow setting defaultTransactionOptions with POJO rather than ReadConcern instance #3032

Merged
merged 4 commits into from Nov 10, 2021

Conversation

durran
Copy link
Member

@durran durran commented Nov 9, 2021

Re: Automattic/mongoose#10805

Description

Right now, startSession({ defaultTransactionOptions: { readConcern: { level: 'snapshot' } } }) fails to compile with a Property 'toJSON' is missing in type '{ level: string; }' but required in type 'ReadConcern'. error. This seems like something that should change.

What is changing?

TransactionOptions.readConcern is now a ReadConcernLike, which allows using strings or { level } object.

Is there new documentation needed for these changes?

What is the motivation for this change?

Make TransactionOptions more user-friendly and line up with Cursor#withReadConcern() and CollectionOptions.

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>
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

test/types/mongodb.test-d.ts Outdated Show resolved Hide resolved
@durran durran requested a review from dariakp November 10, 2021 12:52
Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dariakp dariakp merged commit 53b3164 into main Nov 10, 2021
@dariakp dariakp deleted the NODE-3344 branch November 10, 2021 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
4 participants