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: Compatibility with mongodb-client-encryption #2713

Merged
merged 1 commit into from Jan 27, 2021

Conversation

nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Jan 22, 2021

Permits legacy options being used by mongodb-client-encryption's
use of the MongoClient constructor. Permits legacy WC option style in
insertOne.

NODE-3006

CSFLE Tests Patch

Permits legacy options being used by mongodb-client-encryption's
use of the MongoClient constructor. Permits legacy WC option style in
insertOne.

NODE-3006
@nbbeeken nbbeeken marked this pull request as ready for review January 22, 2021 20:36
Copy link
Contributor Author

@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.

Instead of making a change to 'mongodb-client-encryption` and managing version compatibility I think we should just support the small patches needed to make the existing package work.

Comment on lines +286 to +290
// CSFLE passes in { w: 'majority' } to ensure the lib works in both 3.x and 4.x
// we support that option style here only
if (options && Reflect.get(options, 'w')) {
options.writeConcern = WriteConcern.fromOptions(Reflect.get(options, 'w'));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here that is just checking for the legacy writeConcern shape

Comment on lines +1067 to +1068
useNewUrlParser: { type: 'boolean' } as OptionDescriptor,
useUnifiedTopology: { type: 'boolean' } as OptionDescriptor
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And here that's supporting the old options. These still aren't listed in the props for MongoClientOptions (which is why we have the as casting). I would add that they are deprecated but then our CSFLE lib would emit the warnings with no way to disable.

Copy link
Contributor

@emadum emadum left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@durran durran left a comment

Choose a reason for hiding this comment

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

LGTM

@nbbeeken nbbeeken merged commit d08ddb9 into 4.0 Jan 27, 2021
@nbbeeken nbbeeken deleted the NODE-3006/CSFLE-fixes branch January 27, 2021 15:34
ljhaywar pushed a commit that referenced this pull request Nov 9, 2021
Permits legacy options being used by mongodb-client-encryption's
use of the MongoClient constructor. Permits legacy WC option style in
insertOne.

NODE-3006
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants