{ "_id" : { "month_joined" : 1 }, "number" : 3 }, { "_id" : { "month_joined" : 2 }, "number" : 9 }, { "_id" : { "month_joined" : 3 }, "number" : 5 } 

## Return the Five Most Common “Likes” 

The following aggregation collects top five most “liked” activities in the data set. This type of analysis could help inform planning and future development. 

db.users.aggregate( [ { $unwind : "$likes" }, { $group : { _id : "$likes" , number : { $sum : 1 } } }, { $sort : { number : -1 } }, { $limit : 5 } ] ) 

The pipeline begins with all documents in the users collection, and passes these documents through the following operations: 

• The $unwind operator separates each value in the likes array, and creates a new version of the source document for every element in the array. 

## Example 

Given the following document from the users collection: 

{ _id : "jane", joined : ISODate("2011-03-02"), likes : ["golf", "racquetball"] } 

The $unwind operator would create the following documents: 

{ _id : "jane", joined : ISODate("2011-03-02"), likes : "golf" } { _id : "jane", 

