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.