title: Search on multiple collections in MongoDB
body: <p>I know the theory of MongoDB and the fact that is doesn't support joins, and that I should use embeded documents or denormalize as much as possible, but here goes:</p>
  
  <p>I have multiple documents, such as:</p>
  
  <ul>
  <li>Users, which embed Suburbs, but also has: first name, last name</li>
  <li>Suburbs, which embed States</li>
  <li>Child, which embeds School, belongs to a User, but also has: first name, last name</li>
  </ul>
  
  <p>Example:</p>
  
  <pre><code>Users:
  { _id: 1, first_name: 'Bill', last_name: 'Gates', suburb: 1 }
  { _id: 2, first_name: 'Steve', last_name: 'Jobs', suburb: 3 }
  
  Suburb:
  { _id: 1, name: 'Suburb A', state: 1 }
  { _id: 2, name: 'Suburb B', state: 1 }
  { _id: 3, name: 'Suburb C', state: 3 }
  
  State:
  { _id: 1, name: 'LA' }
  { _id: 3, name: 'NY' }
  
  Child:
  { _id: 1, _user_id: 1, first_name: 'Little Billy', last_name: 'Gates' }
  { _id: 2, _user_id: 2, first_name: 'Little Stevie', last_name: 'Jobs' }
  </code></pre>
  
  <p>The search I need to implement is on:</p>
  
  <ul>
  <li>first name, last name of Users and Child</li>
  <li>State from Users</li>
  </ul>
  
  <p>I know that I have to do multiple queries to get it done, but how can that be achieved? With mapReduce or aggregate?</p>
  
  <p>Can you point out a solution please?</p>
  
  <p>I've tried to use mapReduce but that didn't get me to have documents from Users which contained a state_id, so that's why I brought it up here.</p>