Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Group By and Sum in MongoDB


    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.