Carrot reference
Methods
.groupBy()
given a sequence docid\ jg4itlqwafzlparttfo67 or a list docid\ xwh cukhj9waqaefb7h71 , buckets each item into groups, which then can run additional methods to aggregate by group this method is primarily used in dashboards, which understand how to visualize aggregated results it's foundational for common reporting aggregations to answer questions like "break down our headcount by department" the groupby method itself returns a sequencegroupedby object which is not used directly instead, you can chain additional aggregation methods, like sum() docid\ oqllv6ooattucygljuf7s or mean() docid\ yofswqhmgjc4c5n2tnyn0 onto it to return aggregatedresults that can be visualized in dashboards syntax groupby{expression} evalutes expression on each item in the sequence or list, and buckets into groups based on the result of that expression examples \[1, 2, 3, 4, 5] groupby{it % 2 ? "odd numbers" "even numbers"} sum() will return an aggregatedresult of "odd numbers" = 9, "even numbers" = 4 db job find() groupby{department} count{gender\ female} returns the number of female identified people in each department db job find() groupby{department\ engineering,product ? 'r\&d' department\ sales,marketing ? 's\&m' 'g\&a'} sum{cost} returns the total cost of all jobs bucketed into three groups of `r\&d', 's\&m', and 'g\&a'