Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-81556

Refactor QuerySettings.indexHints idl definition to always be std::vector<IndexHintSpec>

    • Query Execution
    • Fully Compatible
    • v8.0
    • QE 2024-04-15, QE 2024-04-29
    • 53

      Currently, QuerySettings are defined as:

        QuerySettings:
          description: >-
            Struct representing possible settings that may be applied to a given query.
          fields:
            indexHints:
              type:
                variant: [IndexHintSpec, array<IndexHintSpec>]
              optional: true
            queryEngineVersion:
              type: QueryEngineVersion
              optional: true

      While specifying a variant provides additional flexibility to the user (they can either provide an array of index hint specs or a single object), this creates rather ugly code on the server side.

      As part of this patch, we would refactor this (introduce custom serializer/deserializer methods), such that user can still specify IndexHintSpec or an array of specs, while we in code always have a vector of IndexHintSpecs.

      The goal would be to define the serializer, deserializer methods as well as adding tests to ensure their correctness and adjust the breaking code, as now vector<IndexHintSpec> will be used.

            Assignee:
            denis.grebennicov@mongodb.com Denis Grebennicov
            Reporter:
            denis.grebennicov@mongodb.com Denis Grebennicov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: