-
Notifications
You must be signed in to change notification settings - Fork 1.8k
NODE-2815: alternative no generic parameter for options #2659
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
Conversation
c482c5c
to
68a550e
Compare
@@ -49,21 +47,22 @@ export abstract class OperationBase< | |||
// BSON serialization options | |||
bsonOptions?: BSONSerializeOptions; | |||
|
|||
constructor(options: T = {} as T) { | |||
this.options = Object.assign({}, options); | |||
[kSession]: ClientSession; |
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 think this should be [kSession]?: ClientSession
I guess TS has some issues around symbol properties that it's not enforcing this.
e7db3a9
to
6ccab2b
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.
two Qs, thanks for combing through the ||
=> ??
!
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
This removes the generic options property of the base class for all operations, in favor of storing those options on the concrete operations. The work entailed a few major changes to the codebase: - renaming OperationBase to AbstractOperation (in keeping with similar naming conventions for cursors) - requiring sessions to be managed at the `execute` level for concrete operations - finally, removing the generic type parameter for operation definitions NODE-2815
ea7ce79
to
f7275ce
Compare
Description
This is the most basic work required to remove the generic options type for the
OperationBase
type. The general rule of thumb was to add anoptions
property to each subclass with a concrete type specific to that operation. Other work includes:OperationBase
toAbstractOperation
in keeping with the convention introduced in theAbstractCursor
workreadPreference
being stored on a copy of options in the base class)