Skip to content

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

@bhanuprasad04

Description

@bhanuprasad04

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions