I have the following pub in my Meteor app and sub in my iron router, however for the data function I'm not getting anything back, if I change my publish to topics and not public topics then it's fine. But that can't be correct as then have the same publish twice and I get a meteor message about it. Not sure what I'm doing wrong.
I would like to have a set of public topics based on the url
Meteor.publish('topics' , function() {
return Topics.find({$or:[{userId: this.userId},{collaboratorsIds: this.userId},{inviteeId:this.userId}]});
});
Meteor.publish('publicTopics' , function(permalinkUser,permalink) {
return Topics.find({$and:[{permalinkUser: this.permalinkUser},{permalink: this.permalink}]});
});
and in my iron-router I have the following
this.route('topicPublic', {
path: 'public/:permalinkUser/:permalink',
layoutTemplate: 'layoutApp',
waitOn: function(){
return [Meteor.subscribe('publicTopics', this.params.permalinkUser,this.params.permalink)]
},
data: function(){
return Topics.findOne({$and:[{permalinkUser: this.params.permalinkUser},{permalink: this.params.permalink}]});
}
});