-
Notifications
You must be signed in to change notification settings - Fork 53
DOCSP-52035: Await async operations #1202
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
DOCSP-52035: Await async operations #1202
Conversation
✅ Deploy Preview for docs-node ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🔄 Deploy Preview for docs-node processing
|
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!
@@ -31,7 +31,7 @@ async function run() { | |||
const projection = { _id: 0, type: 1, genre: 1 }; | |||
|
|||
// Execute the query using the defined criteria and projection | |||
const cursor = movies | |||
const cursor = await movies |
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.
Any operation that returns a cursor is synchronous, but iteration the cursor is async:
// sync
const cursor = movies.find();
// async
await cursor.toArray();
// or any other cursor iteration method, such as for-await loops:
for await (const doc of cursor) { ... }
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.
Fixed!
* DOCSP-52035: Await update operations * more awaits * BP feedback (cherry picked from commit e52710b)
* DOCSP-52035: Await update operations * more awaits * BP feedback (cherry picked from commit e52710b)
* DOCSP-52035: Await update operations * more awaits * BP feedback (cherry picked from commit e52710b)
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-52035
Staging Links
Self-Review Checklist