Best practice for non joins between two collections


#1

If if have a collection of users and a collection of tasks, and each tasks stores a reference to the user ID that is in ‘assigned’ field… Assuming i already have a local safe collection of just user ids and names only…

What is the best practice when listing out the tasks, to reference something like the users first name in their profile instead of their ID inside of a template?

Something like:

<template name="tasks">
Task: {{ taskname }}

Assigned to: 
{{#each user}}
   {{#if _id value=assigned }}
     {{ profile.firstName }}
    {/if}}
{{/each}}
</template>

#2

You can use a helper to reference the Task. Alternatively you can use the ../ notation to reference the context 1 level up. i.e.

{{taskName}}
{{#each user}}
    {{#if ../assigned}}
        {{profile.firstName}}
    {{/if}}
{{/each}}

#3

This post may give you some ideas. This sounds like a potentially a good place to denormalize.