Better HN
topnewbestaskshowjobs
Log inSign up

nourharidy

1 karma · joined Mar 20, 2015 (11y ago) · 1 submissions

Submissions

comment 11y ago · link · parent

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