-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Performance, Shell API
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.