-
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
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
@@ -526,20 +518,20 @@ function validateLoadBalancedOptions( | |||
hosts: HostAddress[] | string[], | |||
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.ts
andsrc/collection.ts
andsrc/cursor/find_cursor.ts
andsrc/db.ts
andsrc/mongo_types.ts
andsrc/operations/drop.ts
src/connection_string.ts
andtest/unit/connection_string.test.ts
andtest/unit/mongo_client.test.js
resolveSRVRecord
to be async, wrap dns APIs in promisifyvalidateLoadBalancedOptions
now throws since the error does not need to be passed to a callbacksrc/cursor/abstract_cursor.ts
src/encrypter.ts
src/gridfs/download.ts
andtest/integration/gridfs/gridfs_stream.test.js
nextTick
usage, 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.ts
src/mongo_client.ts
no mongos proxies found
condition, this is unreachable, we removed this case in 3.xsrc/operations/connect.ts
src/sessions.ts
src/utils.ts
test/integration/collation/collations.test.js
test/integration/crud/aggregation.test.ts
test/integration/crud/explain.test.js
test/integration/crud/misc_cursors.test.js
test/integration/node-specific/cursor_stream.test.js
test/integration/server-selection/readpreference.test.js
What is the motivation for this change?
Double check the following
npm run check:lint
script<type>(NODE-xxxx)<!>: <description>