[CXX-1126] collection::distinct return should allow iteration over results Created: 11/Nov/16  Updated: 18/Jan/23  Resolved: 18/Jan/23

Status: Closed
Project: C++ Driver
Component/s: API
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: David Golden Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: bgtrack
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-3141 distinct needs to have a way to outpu... Closed
is related to CXX-1406 Provide example and docs for using co... Closed
Backwards Compatibility: Major Change

 Description   

Currently, mongocxx::collection::distinct returns a mongocxx::cursor that provides a single document, the database reply document for the 'distinct' command. This is not in the spirit of the CRUD spec, which requires an iterator over the distinct values.

Possible options:

  • Return a bsoncxx::array::value with the distinct keys as elements
  • Return a (synthesized) mongocxx::cursor over documents like this:

// for keys a .. z
{ "key": "a" }
{ "key": "b" }
...
{ "key": "z" }

Ideally, SERVER-3141 would get spec'd with a document format that we could emulate until it's implemented server-side as a command cursor.



 Comments   
Comment by Rishabh Bisht [ 18/Jan/23 ]

After careful evaluation, we have decided to close this ticket. Please add a comment if the impact of this ticket increases.
Thanks.

Generated at Wed Feb 07 22:01:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.