title: How to "Group By" with MongoDB
body: <p>I would like to know if there is anyway I can "group by" my results with MongoDB/Php.</p>
  
  <p>This is the code I'm using to display my rows:</p>
  
  <pre><code>$count = $col-&gt;find(array('order_id' =&gt; array('$gt' =&gt; '0')))-&gt;count();
  </code></pre>
  
  <p>I need to group them by <code>order_id</code>.</p>
  
  <p>Apparently, we cannot do a <code>count()</code> on a <code>group()</code> as <code>find()</code></p>
  
  <p>WORKS: <code>$countfind = $col-&gt;find()-&gt;count();</code></p>
  
  <p>DOESN'T WORK: <code>$countgroup = $col-&gt;group($keys)-&gt;count();</code></p>
  
  <p>I need to count this groupby please.</p>
  
  <p>Thanks for your help.</p>