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

Provide an index creation helper

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

      CDRIVER-2096 deprecated index creation helpers in favor of sending createIndexes commands directly through generic command helpers. This is documented in the Creating Indexes guide.

      This adds some difficulty for users and wrapping drivers in terms of constructing the command and passing supported options.

      The commitQuorum option is particularly problematic. This option is only supported on 4.4+ servers, and has adverse side-effects on older servers. This is documented by CDRIVER-3748 and the Q&A of the index management spec:

      Starting in 3.4, the server validates all options passed to the createIndexes command, but due to a bug in versions 4.2.0-4.2.5 of the server (SERVER-47193), specifying commitQuorum does not result in an error. The option is used internally by the server on those versions, and its value could have adverse effects on index builds. To prevent users from mistakenly specifying this option, drivers manually verify it is only sent to 4.4+ servers.

      Since libmongoc does not provide an index creation helper, and generic command helpers should not be validating command specific options, this forces the user / wrapping driver to do this validation. In particular, this required additional server selection and wire version checking in the C++ driver's support of commitQuorum (CXX-1998).

      This PR discussion has additional context and motivation: https://github.com/mongodb/mongo-c-driver/pull/662#discussion_r454365303.

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

              Created:
              Updated:
              Resolved: