// Display the nationalities of artists in descending order by number of artists DBQuery.shellBatchSize = 1000; db.Artists.aggregate( [ { $group : { _id : "$Nationality", count : { $sum : 1 }}}, { $sort : { count : -1 }}, { $project : { _id : 0, nationality : "$_id", count : 1}} ]);