path-level multikey tracking
Parent: explain multiKeyPaths interpretation · Published reference · snapshot 2026-10-23 · skill mongodb-cohort-6b0d6e198335
↓ Facts as markdownall context files
Source-anchored research for path-level multikey tracking. Run status: COMPLETED.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
Structure and components
- An empty per-field array denotes no recorded multikey component for that indexed path. Empty arrays also appear in non-multikey index scans: SolarWinds shows {y: []} with isMultiKey: false, and Percona shows {cuisine: []} with isMultiKey: false. (high confidence) [source]
- Internally, a nonempty MultikeyPaths vector has one component set per index key-pattern field. Its sets contain zero-based positions in dotted paths. For {"a.b": 1, "a.c": 1}, array prefixes a and a.b produce {{0,1},{0}}. (medium confidence) [source]
How it works
- Path metadata can allow intersecting range bounds on a scalar field even when another indexed field is an array. For {a:1,b:1} and {a:5,b:[1,2,3]}, the query {a:{$gte:0,$lt:10}} can use [0,10) on a. (high confidence) [source]
- Tracking array prefixes does not make arbitrary bounds intersections safe. When two predicates share an array-producing prefix, the planner must account for their $elemMatch context; metadata alone does not establish that predicates match the same array element. (low confidence) [source]
- multiKeyPaths maps each indexed field to the prefixes that cause multikey indexing. For an index on a.b, an entry ["a"] identifies the ancestor a as the array-bearing prefix; it does not say that b itself is an array. (high confidence) [source]
Problems, failure modes and limitations
- Path tracking does not make all predicate combinations safe. Without a shared $elemMatch context, predicates whose paths share an array-bearing prefix cannot generally have their bounds combined safely; an additional array prefix inside the innermost $elemMatch can also block combination. (low confidence) [source]
Comparisons and alternatives
- For an indexed dotted path, the listed string identifies the array prefix rather than necessarily the leaf. Percona demonstrates multiKeyPaths:{"grades.date":["grades"]} for dates inside an array of grade objects; the array boundary is grades. (high confidence) [source]
- Internally, MultikeyPaths contains one set of zero-based component positions per indexed field when metadata is available. For {'a.b':1,'a.c':1}, array-producing prefixes a and a.b yield {{0,1},{0}}. An empty outer container represents unavailable path-level tracking; it differs from a populated container whose individual sets are empty. (high confidence) [source]
- An empty internal MultikeyPaths vector means the index does not support this tracking; it differs from a correctly sized vector whose component sets are all empty. Do not interpret unavailable path metadata as proof that no indexed path is multikey. (low confidence) [source]
Facts and statements
- Path-level multikey tracking records which prefixes of each indexed field make an index multikey. In explain, multiKeyPaths maps indexed field names to arrays of those prefixes; isMultiKey alone describes the index as a whole. (high confidence) [source]
- For index {a:1,b:1} over {a:5,b:[1,2,3]}, explain can report isMultiKey:true with multiKeyPaths:{a:[],b:["b"]}. The empty a entry means no tracked array-producing prefix for that indexed path, although another indexed field makes the index multikey. (high confidence) [source]
- Empty per-field entries also occur for non-multikey indexes. SolarWinds' original explain example has isMultiKey:false and multiKeyPaths:{y:[]}; Percona shows the same combination for borough. Interpret each entry together with isMultiKey and the index key pattern. (high confidence) [source]
- Do not treat an empty multikey entry as a general schema guarantee. SERVER-127304 documents index path "e.0" over e:["elem1"]: positional access extracts e[0] without marking e multikey, even though e is an array. (low confidence) [source]
- isMultiKey describes the entire index. It can be true while an individual multiKeyPaths entry is empty: Percona shows {cuisine: [], "grades.score": ["grades"]} for a compound index with isMultiKey: true. (high confidence) [source]
- multiKeyPaths is structural metadata, not a performance verdict. Read indexBounds and FETCH stages alongside it: Percona shows a multikey compound index with array-prefix metadata and a FETCH, while SolarWinds illustrates an empty per-field array in an IXSCAN beneath FETCH. (high confidence) [source]
Children
- No children recorded.