Currently we only use DISTINCT_SCAN in a $group for last and first accumulators following a sort. Expand to also use DISTINCT_SCAN for top and bottom accumulators.
- causes
-
SERVER-110803 $top and $bottom ignore sortBy clause when preceeding $sort stage makes it eligible for DISTINCT_SCAN optimization
-
- Closed
-
- is related to
-
SERVER-90017 Parse firstN/lastN/minN/maxN/topN/bottomN with n = 1 into a corresponding first/last/min/max/top/bottom
-
- Closed
-
- related to
-
SERVER-112844 Nested $elemMatch query can uassert when multiple predicates are present
-
- Closed
-
-
SERVER-85213 Rewrite $sort+$group with $first/$last to use $top/$bottom
-
- Backlog
-
-
SERVER-107953 DISTINCT_SCAN with $top and $bottom is only used when grouping field is included as sort prefix
-
- Backlog
-