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: Invalid case on writeconcern makes skip check fail #2773

Merged

Conversation

unusualbob
Copy link

Description

When deprecating top-level writeConcern keys, some code was added to specifically skip them in createUnifiedOptions. You can see the change here

This was ok for all keys except writeConcern, as the key being checked is cast to lowercase, but the original value is not. If given an input key of writeConcern it is converted to writeconcern and then always compared against writeConcern causing the check to always be false. This means that if you have connection options of:

writeConcern: {
  w: 1
}

the createUnifiedOptions function will ultimately add w:1 to the final options object and result in deprecation errors being thrown, despite a valid config.

It seems the values in skip are not used anywhere else, so the simplest solution was to change the case of the value in the skip array.

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.

Thanks for catching this and submitting a fix! LGTM 🚀

@nbbeeken nbbeeken merged commit b1363c2 into mongodb:3.6 Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants