title: MongoDB: Conditional select from one collection based on another collection
body: <p>I'm fairly new to MongoDB and need help doing a select, or perhaps some sort of left join, on one collection based on another collection's data.</p>
  
  <p>I have two collections, animals and meals, and I want to get the animal(s) that has had it's last registered meal after a certain date (let's say 20171001) to determine if the animal is still active.</p>
  
  <pre><code>collection animals:
  {
      name: mr floof,
      id: 12345,
      lastMeal: abcdef
  },
  {
      name: pluto,
      id: 6789,
      lastMeal: ghijkl
  }
  
  collection meals:
  {
      id: abcdef,
      created: 20171008,
      name: carrots
  },
  {
      id: ghijkl,
      created: 20170918,
      name: lettuce
  }
  </code></pre>
  
  <p>So the expected output of the query in this case would be:</p>
  
  <pre><code>{
      name: mr floof,
      id: 12345,
      lastMeal: abcdef
  }
  </code></pre>
  
  <p>As Mr Floof has had his last meal 20171008, i.e. after 20171001.</p>
  
  <p>Hope I was clear enough, but if not, don't hesitate to ask.</p>