title: Translate from SQL to mongo
body: <p>How should this be written in MongoDB?</p>
  
  <pre><code>SELECT field1, field2, product, COUNT(product) as counter
  FROM table
  GROUP BY product
  HAVING counter &gt; 0
  </code></pre>
  
  <p>I have tried with the following, which is nearly a copy from Doctrine manual.</p>
  
  <pre><code>$query = $this-&gt;createQueryBuilder('AcmeBundle:Product')
      -&gt;group(array('product'), array('count' =&gt; 0))
      -&gt;reduce('function (obj, prev) { prev.count++; }')
      -&gt;field('product, field1, field2, count')
  ;
  </code></pre>
  
  <p>This only gives me 1 element "count = 21" which seems it have taken all products and counted them together.</p>