Hey guys, so I have a collection posts
.
On my /topic
page, I create a post and insert it to posts
.
You can go to each topic by going to /:category/:postId
.
My question is, how do I use postId
to retrieve the post in posts
?
I’m using FlowRouter and I am able to get the id through params
.
FlowRouter.route('/:category/:postId', {
name: 'viewTopic',
action: function (params) {
console.log('You are on topic -', params.postId);
BlazeLayout.render('viewTopic');
},
subscriptions: function (params) {
this.register('myPost', Meteor.subscribe('posts', params.postId));
}
});
Now how do I retrieve the data?