Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1564

Cannot set use_cursor or batch_size with aggregation cursor

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.0-rc0
    • Affects Version/s: 3.2.0
    • Component/s: API
    • None

      After upgrading to C Driver 1.9.0, the C++ Driver can no longer set use_cursor or batch_size with options::aggregate. If it sets only batch_size, the batch_size is not actually sent with the initial aggregate command. If it sets use_cursor, then the "cursor" field is included in the aggregate command twice, causing a server error.

      The problem arose when the C Driver dropped support for old MongoDB versions. Its aggregate logic changed to always include the cursor field. This obsoletes the C++ driver's use_cursor option and violates the C++ driver's assumption about how to pass batch_size field.

      Remove the use_cursor option, and if batch_size is set then add the "batchSize" field directly to the top level of the "opts" BSON document passed to mongoc_collection_aggregate, rather than wrapping it in a "cursor" document.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: