Such a $switch creates an if() statement where one of the branches is a fail() expression, and such statement cannot be folded away as it has an unpredicatable runtime behavior.
Every type checking operation that involves a fail() operation should avoid assuming that the fail() can be optimized away, thing that can happen since SERVER-86208 made it return a special, no-bit-set type information
- is caused by
-
SERVER-86208 Generation of $expr doesn't use type information
- Closed