In this lesson, we learn how to group documents in a collection using $group
operator similar to GROUP BY
in SQL. We also look at $sum
operator and see how we can use it to count the number of documents as well as get sum of some field in our grouped results.
Here is the list of operators that we cover in this lesson:
You can see the list of all the available operators in the MongoDB docs.