# $group: Totals, Counts and Averages

The $group stage sorts documents into groups by the value of a field, or puts them all in one group, and computes each group's total, count, average, smallest, biggest and first value with accumulators.

![Cheat sheet: $group: Totals, Counts and Averages](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/baac9c5487cf479f8a5b944ba0c6a4a7.webp)

- Category: MongoDB
- Level: Journeyman
- Tags: $group, Accumulator (mongodb), Aggregation Pipeline, Field Path, mongodb
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/mongodb-aggregation-group-cheat-sheet
