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

collection::distinct return should allow iteration over results

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: API
    • Labels:
      None
    • 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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              david.golden David Golden
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: