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

IndexBuildInterceptor does not faithfully preserve multikey when a document generates no keys

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.2.0-rc3, 4.3.1
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
    • Fully Compatible
    • ALL
    • v4.2
    • Storage NYC 2019-02-25, Storage NYC 2019-05-20, Execution Team 2019-06-03, Execution Team 2019-06-17
    • 57
    • 8

      IndexBuildInterceptor makes an incorrect assumption that a document must generate keys to be considered multikey.

      In particular, sparse compound indexes may not generate keys, but will consider a document to be multikey[1]. MongoDB's validation code is strict and will compare an index's multikey to the multikey output of every document.

      [1] Consider the index {a: 1, b: "2dsphere"} (2dsphere makes an index "auto-sparse"). Consider the document {_id: 1, a: [1,2]}. Because b is omitted, the sparse-ness will result in no index keys being generated. However, because a is an array, that field of the compound index will be considered to be multikey.

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            daniel.gottlieb@mongodb.com Daniel Gottlieb (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: