Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-14821

Investigate changes in SERVER-59805: Provide a way to check for and to remove invalid index catalog options



    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 5.0.4, 5.1.0-rc0
    • manual, Server
    • None


      Downstream Change Summary
      • Adds a new 'metadata' flag to the 'validate' command which only performs validation on the collection metadata. This is to allow users to perform a quick validation to detect invalid index options without scanning all of the documents and indexes.
      • 'validate' detects invalid index options and recommends running 'collMod' to remove the invalid index options.

      Sample log messages:
      2021-09-24T14:43:20.964+00:00 I COMMAND 20514 [conn1] "CMD: validate","attr":

      Unknown macro: {"namespace"}

      2021-09-24T14:43:20.964+00:00 I STORAGE 5980501 [conn1] "Validation of metadata complete for collection. Problems detected","attr":{"namespace":"test.validate_detects_invalid_index_options","uuid":{"uuid":

      Unknown macro: {"$uuid"}


      • The 'collMod' command can be used to remove the invalid index options for all indexes on the given collection.

      Can be executed through:

      Unknown macro: {collMod}


      Sample log messages:
      2021-09-24T14:43:22.309+00:00 I COMMAND 5324200 [conn1] "CMD: collMod","attr":{"cmdObj":{"collMod":"collmod_removes_invalid_index_options"}}
      2021-09-24T14:43:22.309+00:00 W INDEX 23878 [conn1] "Removing unknown field from index spec","attr":{"fieldName":"safe","indexSpec":{"v":2,"key":

      Unknown macro: {"x"}

      2021-09-24T14:43:22.309+00:00 W INDEX 23878 [conn1] "Removing unknown field from index spec","attr":{"fieldName":"force","indexSpec":{"v":2,"key":

      Unknown macro: {"x"}

      2021-09-24T14:43:22.309+00:00 W INDEX 23878 [conn1] "Removing unknown field from index spec","attr":{"fieldName":"xyz","indexSpec":{"v":2,"key":

      Unknown macro: {"z"}


      Description of Linked Ticket

      Invalid index options such as "safe" may have been created in the past, before the createIndexes command started validating options more strictly.

      In MongoDB 5.0, the listIndexes command more strictly validates index options, and fails when an invalid option is encountered. At this point, the only option is to drop and recreate the index.

      This feature request is for the validate command to remove these invalid options as it is validating an index. This would provide a much faster way than recreating the index when fixing an invalid index option.


        Issue Links



              ian.fogelman@mongodb.com Ian Fogelman
              backlog-server-pm Backlog - Core Eng Program Management Team
              Eric Sedor Eric Sedor
              Dave Cuthbert Dave Cuthbert
              0 Vote for this issue
              3 Start watching this issue


                34 weeks ago