Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1688

Delegate .toArray() to the driver if possible

    • Developer Tools
    • 3
    • Not Needed
    • Iteration Yinlong

      A recent customer request highlighted that .forEach() and .toArray() are slow because they are iterating over the cursor one-by-one, which is significantly slower than getting all documents via .toArray() and iterating a simple array of documents.

      We should make mongosh's cursor .toArray() delegate to the driver .toArray(), and investigate whether we can perform some form of batching for .forEach() to improve performance.

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            anna.henningsen@mongodb.com Anna Henningsen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: