Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-4384

Hint option is undocumented and not validated for aggregate and countDocuments

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.24.0
    • Affects Version/s: None
    • Component/s: libmongoc

      The countDocuments CRUD operation supports the same options as the deprecated count operation. This includes hint, although the implementation of countDocuments means that it is provided to aggregate instead of count.

      Looking at the implementation of mongoc_collection_count_documents, the "skip" and "limit" opts are used to create the aggregate command, and any other opts are passed as generic command options to mongoc_collection_read_command_with_opts. This bypasses the options handling that might typically occur in _mongoc_aggregate_opts_parse.

      This apparently was not a problem for the comment option (CDRIVER-4199), which is provided as a bson_value_t; however, I think it may be problematic for the hint option as the functions will skip the typical validation we get through _mongoc_convert_hint.

      Looking at this further, I realized that hint is not even defined for mongoc_aggregate_opts_t in generate-opts.py, so the aggregate operation is also missing documentation and validation.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: