title: MongoDB group by Functionalities
body: <p><strong>In MySQL</strong></p>
  
  <pre><code>select a,b,count(1) as cnt from list group by a, b having cnt &gt; 2;
  </code></pre>
  
  <p>I have to execute the group by function using having condition in mongodb. 
  But i am getting following error. Please share your input.</p>
  
  <p><strong>In MongoDB</strong></p>
  
  <pre><code>&gt; res = db.list.group({key:{a:true,b:true},
  ...                      reduce: function(obj,prev) {prev.count++;},
  ...                      initial: {count:0}}).limit(10);
  
  Sat Jan  7 16:36:30 uncaught exception: group command failed: {
          "errmsg" : "exception: group() can't handle more than 20000 unique keys",
          "code" : 10043,
          "ok" : 0
  </code></pre>
  
  <p>Once it will be executed, we need to run the following file on next.</p>
  
  <pre><code>for (i in res) {if (res[i].count&gt;2) printjson(res[i])};
  </code></pre>
  
  <p>Regards,
  Kumaran</p>