title: how to do a join with mongodb in meteor?
body: <p>so I have a template in my meteor project like this:</p>
  <pre><code>&lt;template name=&quot;getResult&quot;&gt;
      {{#each foundUsers}}
          &lt;input type=&quot;text&quot; id=&quot;fname&quot; value=&quot;{{fname}}&quot;/&gt;&lt;br&gt;
          &lt;input type=&quot;text&quot; id=&quot;lname&quot; value=&quot;{{lname}}&quot;/&gt;&lt;br&gt;
          &lt;input type=&quot;text&quot; id=&quot;type&quot; value=&quot;{{type_id}}&quot;/&gt;&lt;br&gt;
          
          {{#each foundTypes}}
              &lt;input type=&quot;text&quot; id=&quot;type&quot; value=&quot;{{type_name}}&quot;/&gt;&lt;br&gt;
          {{/each}}
      {{/each}}
  &lt;/template&gt;
  </code></pre>
  <p>Now some helpers in js like this using mongodb:</p>
  <pre><code>    Template.getResult.helpers(
      {
          foundUsers: function()
          {
              var searchUser = Session.get(&quot;searchUser&quot;);
              var usf = User.find({fname: &quot;john&quot;}, {});
              
              return usf;
          },
          
          foundTypes: function()
          {
              var tyf = Type.find({_id: new Meteor.Collection.ObjectID(&quot;533d63bef0e236f9d76db905&quot;)}, {});
              
              return tyf;
          }
      });
  </code></pre>
  <p>this gives me a result like:</p>
  <blockquote>
  <p>john</p>
  <p>doe</p>
  <p>ObjectID(&quot;533d63b6f0e236f9d76db8f5&quot;)</p>
  <p>barber</p>
  </blockquote>
  <p>This because I have hardcoded the ObjectID of which type_name to be displayed. How can I get this id from john (ObjectID(&quot;533d63b6f0e236f9d76db8f5&quot;)) to be displayed instead? It's kind of a join query of these two separate I have now. Please help me understand.</p>