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

Provide a means to normalize index specifications.

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Right now both listIndexes and $indexStats return index specifications as they’re stored on disk. This causes problems when the server has accepted a “weird” index specification like {foo: NaN} because anything that needs to compare two index specs has to normalize the specifications.

      This is nontrivial to do. (example: mongo-tools)

      Ideally the server could just normalize all index specifications internally; however, that will probably (as noted in SERVER-27464) require an index version bump. In the meantime, C2C (and likely others?) could benefit significantly from having normalization built into listIndexes and $indexStats so that we’d never see {foo: 2} or {bar: -0.0000000002}, but always just 1 or -1.

      Suggested interface

      Add an optional `indexNormalization` parameter that accepts two strings: `normalized` and `none` (default). (It should fail if any other value is given.) If `normalized` is given, then all index spec values should either be 1, -1, or a string like `2d`. Identical indexes will always have the same normalized spec, and nonidentical indexes will never have the same normalized spec.

      Behavior notes

      • Pre-3.4 index key values should also be addressed (docs). For example, if a pre-3.4 index key value is 0, it should be normalized to be 1.
      • Ignored fields (e.g., background) should be removed.

            Assignee:
            Unassigned Unassigned
            Reporter:
            felipe.gasper@mongodb.com Felipe Gasper
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              None
              None
              None
              None