-
Notifications
You must be signed in to change notification settings - Fork 33
Description
I'm trying to get joins in meteor mongo based on relation id.
When I used your package we are getting data and printed in console as well.
But I'm implementing it in publish method and getting below error.
Exception from sub usersWithAccount id ESzrf5p2AgHJttckF Error: Publish function returned an array of non-Cursors
So, my question is should I write differently in publish method?
Sharing sample code with you for better understanding.
Meteor.publish('usersWithAccount', function() {
var self = this;
var data = Users.aggregate([{
$lookup: {"localField": "accountId","from": "account", "foreignField": "_id","as":"accountinfo"}
}],
Meteor.bindEnvironment(
function(err, result) {
// Add each of the results to the subscription.
_.each(result, function(e) {
self.added("usersWithAccount", e._id, e);
});
self.ready();
},
function(error) {
Meteor._debug( "Error doing aggregation: " + error);
}
));
return data;
});