The plan cache key encoder in canonical_query_encoder.cpp only handles $meta: "textScore" as a special case, emitting "t". All other $meta sort types (randVal, geoNearDistance, score, etc.) fall through to the descending branch, emitting "d". This causes incorrect plan cache hits between queries that should be treated as distinct. Each $meta sort type should produce its own unique key suffix, with unit tests added to verify no collisions occur.
- is related to
-
SERVER-119464 Aggregation pipeline with $match: { $text }, $sort, $project gives an error
-
- In Code Review
-