-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
Permits legacy options being used by mongodb-client-encryption's use of the MongoClient constructor. Permits legacy WC option style in insertOne. NODE-3006
There was a problem hiding this 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.
// 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')); | ||
} |
There was a problem hiding this comment.
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
useNewUrlParser: { type: 'boolean' } as OptionDescriptor, | ||
useUnifiedTopology: { type: 'boolean' } as OptionDescriptor |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Permits legacy options being used by mongodb-client-encryption's use of the MongoClient constructor. Permits legacy WC option style in insertOne. NODE-3006
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