Async function usage inside cursor.forEach()/.map() callback does not work properly

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Critical - P2
    • 1.0.5
    • Affects Version/s: None
    • Component/s: Shell API
    • None
    • Iteration Ibadan
    • Not Needed

      coll = db.getSiblingDB('test').test_coll;
      coll.drop();
      coll.insertOne({ a: 0 });
      print('before')
      coll.find().forEach(() => {
        coll.find().toArray()
        print('inside')
      });
      print('after')
      

      prints

      before
      after
      inside
      

              Assignee:
              Anna Henningsen
              Reporter:
              Anna Henningsen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: