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.
- is related to
-
SERVER-28975 Cannot remove document with 2dsphere partialFilter index
- Closed
-
SERVER-40825 In-progress hybrid builds should only record the set difference of removed and inserted keys
- Closed