Hello,
Its the first time I get to use aggregation with Meteor, and I seem to get it all working except that I get an error in browsers console. So the method looks like that:
'reports.aggregation' (companyId) {
check(companyId, String);
const pipeline = [
{$match: {companyId: companyId}},
{$group: {
_id: {
year: { $year: "$timestamp" },
month: { $month: "$timestamp" },
day: { $dayOfMonth: "$timestamp" }
},
count:{$sum: 1 }
}
}
]
return Reports.aggregate(pipeline);
}
so I get an error and results after the error in my browser console.
Exception while simulating the effect of invoking 'reports.aggregation' TypeError: Reports.aggregate is not a function
I was wondering maybe I need to import meteorhacks:aggregate on the server? Did tried few import strings but unsuccessfully. Anyone have ideas?
Thanks!