Aggregation supports for meteor.
mrt add aggregation
Client Usage (CBP is required):
People = new Meteor.Collection("people");
People.aggregate(pipe, function(err, docs){
if(docs){
Session.set("result", docs);
}
});
Server Side Usage:
People = new Meteor.Collection("people");
var docs = People.aggregate(pipe);
A Pipe can be created like below:
// creates pipe
var pipe = [];
pipe.push({
$match : {
favoriteColor : {
$exists : 1
}
}
});
pipe.push({
$group : {
_id : "favoriteColor",
count : {
$sum : 1
}
}
}
});
This project is very experimental. I'm just testing meteor packaging system. Result documents are not reactive!