Uploaded image for project: 'Node Driver'
  1. Node Driver
  2. NODE-1684

Define [Symbol.iterator] on our Cursor objects

    XMLWordPrintable

    Details

      Description

      Starting in Node 10.3, you can have async for...of loops

      async function() {
        for await (const item of interable) {
        }
      }
      

      and in Node 8, we could still use an iterator to return promises to for...of

       
      async function foo() {
        for (const _item of iterable) {
          const item = await _item;
        }
      }
      

      It would be a good idea to add a Symbol.iterator method to our cursors to allow them to be used in for...of loops

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: