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

Include the prefixes of the indexed fields that cause index to be multikey in explain output

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.8
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Fully Compatible
    • Query 12 (04/04/16), Query 13 (04/22/16), Query 14 (05/13/16)

      Include the path-level multikey information to the explain output as a field called "multiKeyPaths". The value associated with the "multiKeyPaths" field is an object with keys equal to those in the index key pattern and values equal to an array of strings corresponding to paths that cause the index to be multikey.

      For example, with the index {a: 1, 'b.c': 1, 'b.d': 1} where the paths "b" and "b.c" cause the index to be multikey (e.g. from inserting the document {a: 1, b: [{c: ["w", "x"], d: 3}, {c: ["y", "z"], d: 4}]}), we'd have

      {
          "stage" : "IXSCAN",
          "keyPattern" : {
              "a" : 1,
              "b.c" : 1,
              "b.d" : 1
          },
          "indexName" : "a_1_b.c_1_b.d_1",
          "isMultiKey" : true,
          "multiKeyPaths" : {
              "a" : [ ],
              "b.c" : [
                  "b",
                  "b.c"
              ],
              "b.d" : [
                  "b"
              ]
          },
          ...
      }
      

      Note: The "multiKeyPaths" field is still included in the explain output when isMultiKey=false as a way to indicate that the index supports tracking path-level multikey information.

            Assignee:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: