[CXX-1564] Cannot set use_cursor or batch_size with aggregation cursor Created: 23/Apr/18 Updated: 28/Oct/23 Resolved: 18/May/18 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | API |
| Affects Version/s: | 3.2.0 |
| Fix Version/s: | 3.3.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | A. Jesse Jiryu Davis | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Description |
|
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. |
| Comments |
| Comment by Githook User [ 18/May/18 ] | |||
|
Author: {'username': 'ajdavis', 'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com'}Message: | |||
| Comment by A. Jesse Jiryu Davis [ 23/Apr/18 ] | |||
|
Once done, in test/sessions.cpp set the aggregate batch size to 2 so we can be certain that the right lsid is sent with the aggregate command's getMore. Add to the aggregate section:
Also add asserts in this section in collection_mocked.cpp:
|