-
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(NODE-4936)!: remove unsupported options from db.command and admin.command #3775
Conversation
9c79022
to
d35862e
Compare
d35862e
to
eaa525e
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.
We're missing the following test from the kickoff:
Add WC not supported test to match the RC one. (The spec tests that RC/WC is not inherited from db/client, we supported it as a direct option)
@@ -49,7 +49,6 @@ const kSession = Symbol('session'); | |||
*/ | |||
export abstract class AbstractOperation<TResult = any> { | |||
ns!: MongoDBNamespace; | |||
cmd!: Document; |
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.
removed because this no longer exists?
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.
Kinda, the xx!
properties on this class are tech debt from the rapid TS conversion, we couldn't sort out which subclasses actually defined these and which didn't. Specifically cmd what only being attached by the RenameOperation
so we don't need it defined on this super class. But also Rename is somewhat special in that most of our commands are build in the exec function, not in the constructor, so even Rename doesn't define this property anymore.
src/operations/run_command.ts
Outdated
override options: RunCommandOptions; | ||
command: Document; | ||
|
||
constructor(parent: OperationParent | undefined, command: Document, options?: RunCommandOptions) { | ||
super(parent, options); | ||
this.options = options ?? {}; | ||
constructor(parent: Db, command: Document, options: RunCommandOptions) { | ||
super(options); | ||
this.options = options; | ||
this.command = command; | ||
this.ns = parent.s.namespace.withCollection('$cmd'); | ||
} |
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.
override options: RunCommandOptions; | |
command: Document; | |
constructor(parent: OperationParent | undefined, command: Document, options?: RunCommandOptions) { | |
super(parent, options); | |
this.options = options ?? {}; | |
constructor(parent: Db, command: Document, options: RunCommandOptions) { | |
super(options); | |
this.options = options; | |
this.command = command; | |
this.ns = parent.s.namespace.withCollection('$cmd'); | |
} | |
constructor(parent: Db, public command: Document, public override options: RunCommandOptions) { | |
super(options); | |
this.ns = parent.s.namespace.withCollection('$cmd'); | |
} |
optional
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.
done
Description
What is changing?
Internal:
noResponse
Is there new documentation needed for these changes?
What is the motivation for this change?
Spec compliance
Release Highlight
db.command() and admin.command() unsupported options removed
These APIs allow for specifying a command BSON document directly, so the driver does not try to enumerate all possible commands that could be passed to this API in an effort to be as forward and backward compatible as possible. Supporting various server-side options that are encoded into the command document is difficult to correctly support for all use cases.
The
db.command()
andadmin.command()
APIs have theiroptions
types updated to accurately support options compatible on all commands that could be passed to either API. Perhaps most notably,readConcern
andwriteConcern
options are no longer handled by the driver, users must attach these properties to the command that is passed to the.command()
method.Double check the following
npm run check:lint
scripttype(NODE-xxxx)[!]: description
feat(NODE-1234)!: rewriting everything in coffeescript