Database

db={restaurants:[{"location":"London","type_of_food":"Nice"},{"location":"London","type_of_food":"Sweet"}]}

Query

db.restaurants.aggregate([{$match:{location:"London"}},{$group:{_id:"$type_of_food",count:{$sum:1}}}])

Result