Depends a bit on how you want to do your aggregation, obviously. Andrew's recipe works good if you have a smallish sized database, and want to get up-to-the-minute aggregation stats each time you connect. For instance, it works well for aggregating stats for logged in client in a chat program.
For other types of apps, there are some other patterns. We're finding that with larger databases that have streaming data coming in, we needed a statistics writer to write data into a collection specifically designed for handling stats. We use an observeChanges query, and simply aggregate stats as the records come into the database. Basically, a real-time aggregation.
We're also finding that it makes a lot of sense to run the aggregation pipeline that Andrew demonstrates from an API call, or a Meteor Method, rather than in the publication function. Basically, it's asynchronous enough and expensive enough that it makes sense to fire it with a Meteor.call(), rather than put it into a publication function. If you've got it firing as a Meteor.method(), you simply need to return a json object, and then catch it in the Meteor.call() callback.
Meteor.call('aggregateStats', function(error, result){
if(result){
console.log(result);
}
});
However, I prefer to have a DailyStats collection, or something similar, and to write the aggregated statistics into a single record in the collection. Then you get an easy timeline of statistics, and the publication/subscription is nothing more complicated than what's widely documented in all the tutorials and best practices. But, again, that approach requires a statistics writer file or function.