This issue started with the commit for SERVER-38949. Under that ticket we ban index use for negation of equality to array. It is still possible however to generate a plan cache entry for a negation of equality to non-array, and to then use the cached entry for negation of equality to array.
To address we will likely want to modify the plan cache to discriminate between distinguish between array and non-array values for {$not: {$in: ...}} entries.
The invariant triggered is:
Invariant failure *tightnessOut == IndexBoundsBuilder::EXACT src/mongo/db/query/index_bounds_builder.cpp 429
- is related to
-
SERVER-38949 Incorrect index bounds for {$ne: ["String"]} query
- Closed
- related to
-
SERVER-40691 $nin:[[],...] queries are not indexed
- Closed