-
Type:
Improvement
-
Status: Open
-
Priority:
Major - P3
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: Backlog
-
Component/s: Aggregation Framework
-
Labels:None
-
Sprint:Query 2019-07-29
-
Case:
A very common use of an aggregation is to count elements by group:
db.items.aggregate([ {$group: {_id: category, count: {$sum: 1}}}])
|
If there is an index over category, this pipeline could be covered and no document retrieval is necessary.
Since this is a quite common pattern, you may take it into account and make use of indexes.
- is related to
-
SERVER-20066 Query planner should consider index scans on empty query predicates
-
- Closed
-
- related to
-
SERVER-4507 aggregation: optimize $group to take advantage of sorted sequences
-
- Open
-