Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Publish function returned an array of non-Cursors #46

Open
bhanuprasad04 opened this issue Mar 27, 2018 · 1 comment
Open

Error: Publish function returned an array of non-Cursors #46

bhanuprasad04 opened this issue Mar 27, 2018 · 1 comment

Comments

@bhanuprasad04
Copy link

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;
});

@lastpeony
Copy link

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants