MongoDB provides a rich set of aggregation. $group is one of them, with the help of $group, we can group documents (similar as group By in SQL). Lets understand by an example: Suppose we have following collection of blogs: [js] { userId:1, name:"Suroor", title:"AngularJS: Getting started with Directive", rating:3} { userId:2,...
MongoDB provides several ways of computing the average value of a group in a collection. One of the simplest ways of determining average is using the method db.collection.group(). The method db.collection.group() bunches the documents of a collection on the basis of the keys mentioned and executes aggregation functions on them. This...