-
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
feat: remove top-level write concern options #2642
Conversation
ed0868f
to
b4346bb
Compare
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, mod one nit request 👍
src/operations/connect.ts
Outdated
} | ||
|
||
if (connStrOptions.srvHost) { | ||
connStrOpts.srvHost = connStrOptions.srvHost; | ||
} | ||
|
||
// Any write concern options from the URL will be top-level, so we manually | ||
// move them options under `object.writeConcern` | ||
const wcKeys = ['w', 'wtimeout', 'j', 'journal', 'fsync']; |
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.
I'd prefer to see this in a const exported by write_concern.ts
, to make future maintenance easier. Perhaps we can restore the export of writeConcernKeys
that was deleted and add the missing journal
key in?
5d2b9aa
to
7e543c4
Compare
7e543c4
to
e1246db
Compare
Description
Code changes include: the
WriteConcern
type now has only one property:writeConcern: WriteConcern | WriteConcernSettings
, whereWriteConcernSettings
(naming up for debate) encompasses the old top-level options.WriteConcern.fromOptions
ignores the old top-level WC options.The change to
legalOptionNames
indb.ts
means the old top-level WC options will be filtered out when creating aDb
. The change tovalidOptionNames
inoperations/connect.ts
means it will either error or warn (configurable) if the old top-level WC options are passed to aMongoClient
.Test changes include everything from #2624 and now all options that are not being used to create a connection string use the
writeConcern
key.NODE-1722