Skip to content

Support async iteration with query cursors and aggregation cursors #6737

@vkarpov15

Description

@vkarpov15

for/await/of is natively supported in Node.js 10.x, so ideally you should be able to do something like:

for await (const doc of Model.find().cursor({ asyncIterable: true })) {}

or

for await (const doc of Model.find().cursor().asyncIterable()) {}

@lineus any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions