title: Mongodb aggregation query by grouping multiple collections
body: <p>I have two collections in mongodb.</p>
  
  <h2>requests collection</h2>
  
  <ol>
  <li>_id</li>
  <li>ipaddress</li>
  <li>createdon</li>
  </ol>
  
  <h2>geoip collection</h2>
  
  <ol>
  <li>_id </li>
  <li>ipaddress</li>
  <li>country</li>
  <li>city</li>
  </ol>
  
  <p>geoip is a look up table for IP address, which is unique here.</p>
  
  <p>I need the following result, to find the total number of requests from each country. In other words, the following 2 columns.</p>
  
  <p>country and recordcount (from requests collection based on the ipaddress)</p>
  
  <p>Since this requires grouping 2 separate collections and combining them to get the results, I am at a loss here.</p>