Right now i use this command :
restos.aggregate([{$unwind:"$categories"},
{$group:{_id:'$categories.title', count:{$sum:1}}},
{$project:{ type:"$_id", count: 1,_id:0}}])
which outputs me data like this :
{ "count" : 3, "type" : "Sandwiches" }
What i'd like is to have this instead:
{ "Sandwiches" : 3 }
How can i achieve this ? I am using python with pymongo, will i need to format it manually ?
Thanks