Hacker News new | ask | show | jobs
by nourharidy 4116 days ago
About joins in subscriptions, other than the community package Publish Composite, there is an officially supported alternative yet very poorly documented or mentioned, using the Spacebars layer: It is the template helper argument feature, which is in my opinion must more reliable and developer friendly, you can read about it here: https://www.discovermeteor.com/blog/spacebars-secrets-explor...

A typical example would be to display a "post" with comments from two different collections:

Template: <template name="posts"> {{#each post}} {{title}} {{body}} {{#each comment _id}} {{username}} {{body}} {{/each}} {{/each}} </template>

Helpers definition: Template.posts.helpers({ post:function(){ return Posts.find(); }, comment:function(post_id){ return Comments.find({post_id: post_id}); } })