I\'m working on the following document
{
\"_id\" : 12,
\"firstName\" : \"wer\",
\"People\" : [
{
\"uuid\" : \"123\",
\"name\" : \"sugun\
You need to add a package to expose the aggregate
feature:
meteor add monbro:mongodb-mapreduce-aggregation
Then you can use the code like normal:
var MyCollection = new Mongo.Collection('metrics');
var pipeline = [
{$group: {_id: null, resTime: {$sum: "$resTime"}}}
];
var result = MyCollection.aggregate(pipeline);
Just a couple of things to note, this works best on the server side. For docs to use it on the client side a fork of the package is needed, check the package's docs: https://atmospherejs.com/monbro/mongodb-mapreduce-aggregation