-
Notifications
You must be signed in to change notification settings - Fork 1.8k
refactor(NODE-4632): async await in MongoClient, ClientSession, and AbstractCursor #3428
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
refactor(NODE-4632): async await in MongoClient, ClientSession, and AbstractCursor #3428
Conversation
97bbe38 to
b1cac7a
Compare
b1cac7a to
f562a80
Compare
baileympearson
left a comment
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.
Looks really good overall, just some questions and minor comments
| mongoOptions: MongoOptions, | ||
| isSrv: boolean | ||
| ): MongoParseError | undefined { | ||
| ): void { |
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.
Can we annotate this function as throwing / add a comment? The error information used to be codified in the return type, but now it's lost.
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!
src/mongo_client.ts
Outdated
| }); | ||
| }); | ||
| return maybeCallback(async () => { | ||
| // If a connection already been established, we can terminate early |
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.
| // If a connection already been established, we can terminate early |
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
NODE-4632
What is changing?
src/change_stream.tsandsrc/collection.tsandsrc/cursor/find_cursor.tsandsrc/db.tsandsrc/mongo_types.tsandsrc/operations/drop.tssrc/connection_string.tsandtest/unit/connection_string.test.tsandtest/unit/mongo_client.test.jsresolveSRVRecordto be async, wrap dns APIs in promisifyvalidateLoadBalancedOptionsnow throws since the error does not need to be passed to a callbacksrc/cursor/abstract_cursor.tssrc/encrypter.tssrc/gridfs/download.tsandtest/integration/gridfs/gridfs_stream.test.jsnextTickusage, the callback for close was being called sync, now that we always do things async it changed the order of events. removing nextTick brings us back to that behaviorsrc/gridfs/upload.tssrc/mongo_client.tsno mongos proxies foundcondition, this is unreachable, we removed this case in 3.xsrc/operations/connect.tssrc/sessions.tssrc/utils.tstest/integration/collation/collations.test.jstest/integration/crud/aggregation.test.tstest/integration/crud/explain.test.jstest/integration/crud/misc_cursors.test.jstest/integration/node-specific/cursor_stream.test.jstest/integration/server-selection/readpreference.test.jsWhat is the motivation for this change?
Double check the following
npm run check:lintscript<type>(NODE-xxxx)<!>: <description>