publish subscribe - Meteor Group Collection by Field -
i trying return collection (postings) grouped field (status). pretty new mongo , meteor. query below gives me collections grouped status # of docs status... want same thing have actual documents in there. also, able publish/subscribe reactivly update. creating admin dashboard groups postings current status. a friend provided following gist, bit on head: https://gist.github.com/ryw/8827179 db.postings.group({ key: {status: 1}, initial: {sum:0}, reduce: function(doc, prev) { prev.sum += 1; } }) thanks! if need of documents on client, publish whole collection , let template code group them. client tracker.autorun(function() { if (meteor.user()) { meteor.subscribe('allpostings'); } }); template.admin.helpers({ postings: function() { if (session.get('currentstatus')) { return postings.find({status: session.get('currentstatus')}); } }, statuses: function() { return _.uniq(_.pluck(postings.find().fetch(), ...