The shell uses DBCommandCursor to iterate results returned from the "cursor-generating commands" (find, aggregate, listIndexes, listCollections). The implementation is primarily in Javascript:
Rewriting this functionality in C++ would most likely make this code run faster. It would also ensure that the shell does not consume excessive memory, since memory required to buffer each batch of results could be reclaimed after the batch is exhausted. Currently, the Javascript engine's garbage collector may not run frequently enough to reclaim memory in a timely manner, especially for queries returning many megabytes worth of results.
- is related to
-
SERVER-23219 DBCommandCursor doesn't route getMore operations to original server
- Closed
- related to
-
SERVER-58491 Consolidate the C++ native cursor implementation with the DBCommandCursor-based one in the shell js
- Backlog
-
SERVER-65955 Shell's special query path for exhaust queries or "$cmd" queries trips tassert on negative limit
- Closed
-
SERVER-68213 Stop generating an OP_QUERY-style query representation in the shell's find implementation
- Closed