Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aggregate in Meteor

Tags:

mongodb

meteor

I need to make a query using aggregate in the MongoDB, but as the meteor does not support'm trying to use the extension server-aggregation. I'm using the code on the server like this:

var result = aggregates('publicadores',[{$match: {_id : _id}},{ $unwind: '$relatorios' },{ $sort: {'relatorios.mes': -1 }}]);

The consultation is being done correctly, but when passing data by Publish Meteor is returning the following error:

Exception from sub MvPSGj5bf2jHFsRng Error: Publish function returned an array of non-Cursors

Does anyone know how to resolve this error, or some other way to apply the aggregate in Meteor?

like image 701
Murilo Venturoso Avatar asked Dec 14 '25 01:12

Murilo Venturoso


1 Answers

You can try https://atmospherejs.com/meteorhacks/aggregate packages for MongoDB

like image 145
Sivailango Avatar answered Dec 17 '25 00:12

Sivailango