Question : how to write the aggragation in mongodb
Answered by : lovely-lapwing-j7d5miaxkeu2
> db.mycol.aggregate([{$group : {_id : "$by_user", num_tutorial : {$sum : 1}}}])
{ "_id" : "tutorials point", "num_tutorial" : 2 }
{ "_id" : "Neo4j", "num_tutorial" : 1 }
>
Source : https://www.tutorialspoint.com/mongodb/mongodb_aggregation.htm | Last Update : Thu, 24 Dec 20