-
Type: Bug
-
Resolution: Fixed
-
Priority: Critical - P2
-
Affects Version/s: 6.0.5
-
Component/s: Aggregation Framework
-
None
-
Query Execution
-
Fully Compatible
-
ALL
-
-
QE 2023-04-03
When $avg-ing a field within a $group stage after several back-to-back $group aggregates, the aggregate is returning the sum of the field and not the average. Strangely enough, the $avg command will work on a multi-group aggregate, IF one inserts a non-$group command, (e.g. $sort, $match) before that last $group stage in which the $avg is taking place.