Skip to content

Commit

Permalink
docs(aggregate): make aggregation Symbol.iterator docs actually use a…
Browse files Browse the repository at this point in the history
…ggregate()

Re: #8280
  • Loading branch information
vkarpov15 committed Nov 3, 2019
1 parent c1e49c3 commit 69bf575
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/aggregate.js
Expand Up @@ -1011,20 +1011,20 @@ Aggregate.prototype.catch = function(reject) {

/**
* Returns an asyncIterator for use with [`for/await/of` loops](http://bit.ly/async-iterators)
* This function *only* works for `find()` queries.
* You do not need to call this function explicitly, the JavaScript runtime
* will call it for you.
*
* ####Example
*
* for await (const doc of Model.find().sort({ name: 1 })) {
* const agg = Model.aggregate([{ $match: { age: { $gte: 25 } } }]);
* for await (const doc of agg) {
* console.log(doc.name);
* }
*
* Node.js 10.x supports async iterators natively without any flags. You can
* enable async iterators in Node.js 8.x using the [`--harmony_async_iteration` flag](https://github.com/tc39/proposal-async-iteration/issues/117#issuecomment-346695187).
*
* **Note:** This function is not if `Symbol.asyncIterator` is undefined. If
* **Note:** This function is not set if `Symbol.asyncIterator` is undefined. If
* `Symbol.asyncIterator` is undefined, that means your Node.js version does not
* support async iterators.
*
Expand Down

0 comments on commit 69bf575

Please sign in to comment.