Skip to content

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

Merged
merged 3 commits into from
Jul 18, 2025

Conversation

norareidy
Copy link
Collaborator

@norareidy norareidy commented Jul 18, 2025

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-52035

Staging Links

  • code-snippets/indexes/compound.js
  • code-snippets/indexes/multikey.js
  • code-snippets/indexes/single-field.js
  • code-snippets/indexes/text.js
  • crud/query/geo
  • crud/query/text
  • crud/update
  • Self-Review Checklist

    • Is this free of any warnings or errors in the RST?
    • Did you run a spell-check?
    • Did you run a grammar-check?
    • Are all the links working?
    • Are the facets and meta keywords accurate?
    • Are the page titles greater than 20 characters long and SEO relevant?

    Copy link

    netlify bot commented Jul 18, 2025

    Deploy Preview for docs-node ready!

    Name Link
    🔨 Latest commit 67253ad
    🔍 Latest deploy log https://app.netlify.com/projects/docs-node/deploys/687a7d41699ee90008eb60b3
    😎 Deploy Preview https://deploy-preview-1202--docs-node.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify project configuration.

    @docs-builder-bot
    Copy link

    docs-builder-bot commented Jul 18, 2025

    🔄 Deploy Preview for docs-node processing

    Item Details
    🔨 Latest Commit 46e28b2b9d6a5c5d9a840789866e90c8c3529ff4
    😎 Deploy Preview https://deploy-preview-1202--docs-node.netlify.app
    🔍 Build Logs View Logs

    @norareidy norareidy changed the title DOCSP-52035: Await update operations DOCSP-52035: Await async operations Jul 18, 2025
    Copy link
    Collaborator

    @jordan-smith721 jordan-smith721 left a 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

    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) { ... }

    Copy link
    Collaborator Author

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Fixed!

    @norareidy norareidy requested a review from baileympearson July 18, 2025 16:59
    @norareidy norareidy merged commit e52710b into mongodb:master Jul 18, 2025
    6 checks passed
    @norareidy norareidy deleted the DOCSP-52035-update-ops-fix branch July 18, 2025 18:42
    norareidy added a commit that referenced this pull request Jul 18, 2025
    * DOCSP-52035: Await update operations
    
    * more awaits
    
    * BP feedback
    
    (cherry picked from commit e52710b)
    norareidy added a commit that referenced this pull request Jul 18, 2025
    * DOCSP-52035: Await update operations
    
    * more awaits
    
    * BP feedback
    
    (cherry picked from commit e52710b)
    norareidy added a commit that referenced this pull request Jul 18, 2025
    * DOCSP-52035: Await update operations
    
    * more awaits
    
    * BP feedback
    
    (cherry picked from commit e52710b)
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    4 participants