I have a publication that publishes a selection of users and fields depending on the user, but it doesn't work. I get the output below when i try to run it.
TypeError: Cannot read property 'call' of undefined
at PublicationCollector.collect (packages/johanbrook:publication-collector/publication-collector.js:67:28)
My publication looks like this:
Meteor.publish('users', function () {
const user = Meteor.users.findOne(this.userId);
if (!user) {
return this.ready();
}
if (Roles.userIsInRole(user._id, ['admin'])) {
return Meteor.users.find({}, {
fields: {
createdAt: 1,
emails: 1,
roles: 1,
},
});
}
return this.ready();
});
I have emptied and populated both the user and role collection and trying just to get the test working like this:
Oh, it worked when I imported the file with the publication.
I find it a bit strange that I didn't need to do that with the other collections though.
But I will close this issue.
I have a publication that publishes a selection of users and fields depending on the user, but it doesn't work. I get the output below when i try to run it.
My publication looks like this:
I have emptied and populated both the user and role collection and trying just to get the test working like this: