Database
[{name:"Example 1",year:"2012"},{name:"Example 2",year:"2012"},{name:"Example 3",year:"2013"},{name:"Example 4",year:"2014"}]
Query
db.collection.aggregate([{$group:{_id:"$year",count:{$sum:1}}},{"$sort":{count:-1}}])