{{#each featured}}
{{> itemAndPost}}
{{/each}}
</template>```
second template:
```<template name="itemAndPost">
<div class="text">{{item.text}}</div>
<div class="footer">
{{post.name}}
</div>
</template>```
Of course I could just pass in the item and get the post with a helper, but they both have a lot of fields that I need.
Is this approach possible?
Well, #each expect cursor or array to iterate in it and provide as data context.
So i dont see problem there as long as you can provide it one.
But both these Item.find and Posts.find are cursors, so probably you need to transform them using "map" or something like that to array of objects, or array of arrays.
But I never tried something like that myself.
but they both have a lot of fields that I need.
what exactly is limiting you to use all fields from both, or I dont understand what you mean by that sentence
You can’t use a cursor as the value part of an object property. However, you could fetch() each cursor, in which case you’d get an item array and a post array.
Now merge them however you want and return 1 array consisting from objects which have needed fields from both arrays
But it still seems strange, cause you dont know if these cursors return same number of documents, there can be sorting issues…
But if you really have to be using it this way, why not… you have 2 source arrays, merge them as you want and return 1 array over which you can iterate and each item of that array will have all properties you need.
However, as @shock says, if you want to essentially join the results of two finds together, so a simple helper returns the related parts out of each find, you will have to code that accordingly.