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

collection::distinct return should allow iteration over results

    XMLWordPrintable

Details

    • New Feature
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • API
    • None
    • 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

              Unassigned Unassigned
              david.golden@mongodb.com David Golden
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: