List Two collections


#1

I have two collections.

1: Categories
2: Tasks

I can list the categories:

{{#each catlist}}
        {{> catlisttemp}}

    {{/each}}
<template name="catlisttemp">
   {{category}}
</template>

But howto list all tasks under every category from the tasks collections that have parentId to the category?

Category
task
task
task
Category
task
task


#2

This should do it :slightly_smiling_face:

Template.catlisttemp.helpers({
  tasks(){
  	return Tasks.find({category:this._id})
  }
}
<template name="catlisttemp">
	{{category}}
	{{#each tasks}}
		{{name}} etc...
	{{/each}}'
</template>