Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-20770

Consolidate the two code paths for running find commands in the mongo shell

    • Query Execution
    • QE 2023-05-29
    • 0

      The shell uses DBCommandCursor to iterate results returned from the "cursor-generating commands" (find, aggregate, listIndexes, listCollections). The implementation is primarily in Javascript:

      https://github.com/mongodb/mongo/blob/bd76599a88e8062c634eeb6918bb30f868bc6042/src/mongo/shell/query.js#L650-L804

      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.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: