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

Aggregation batchSize can't be set on subsequent getMore in the shell

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.14
    • Affects Version/s: None
    • Component/s: Shell
    • None
    • Fully Compatible
    • Platforms 2016-08-26, Platforms 2016-09-19

      The wire protocol permits batchSize to be set for getMore's but there is no way to access this on a cursor returned by the 'aggregate' helper.

      The net result is that batchSize can be set only for the initial batch in aggregation, after that it is whatever fits in the 4MB getMore payload (or 16MB when 3.4 comes out, SERVER-21797).

      The documentation on the 'aggregate' helper method says:

      Specify subsequent batch sizes to OP_GET_MORE operations as with other MongoDB cursors.

      Except that isn't possible either. Even if it were possible to construct an OP_GET_MORE manually in the shell, it requires knowledge of the cursor ID, which is not accessible when using the aggregate helper.

      This ticket is a request to expose a batchSize method on cursors returned by the collection object aggregate helper method.

      Note that some drivers at least already implement this in a much more natural way; C#, for example, implements a batchSize option to the aggregate method that applies for both the initial command and subsequent getMores, completely abstracting the silly shenanigans going on at the wire protocol.

            Assignee:
            jonathan.reams@mongodb.com Jonathan Reams
            Reporter:
            andrew.ryder@mongodb.com Andrew Ryder (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: