title: Node.js : How to return Object in Query Aggregation?
body: <p>I need to calculate sum for specified field from my collection using <code>group by</code></p>
  
  <p>So that, I used aggregate function. </p>
  
  <p>My wish is function should return Object only. When I use <code>aggregate</code>, it returns the <code>Array of Objects</code>.</p>
  
  <p>But my query was returns Array of objects (<code>[{..}, {..}, {..}]</code>) not single object(<code>{..}</code>) .</p>
  
  <p>For example, So far I tried</p>
  
  <p><b>Specified with Array [ ] structure </b></p>
  
  <pre><code>MyModel.aggregate(
    [
      {$match : ... },
      {$group : ... }
    ], function(err, result) {
        console.log(result);
  }); 
  </code></pre>
  
  <p><b>Specified without Array [ ] structure </b></p>
  
  <pre><code>MyModel.aggregate(
      {$match : ... },
      {$group : ... }
    , function(err, result) {
        console.log(result);
  });
  </code></pre>
  
  <p>The above both scenarios returns the same. like,</p>
  
  <pre><code>[
    {
      ...
      ...
    }
  ]
  </code></pre>
  
  <p>My expected <code>result</code> only an <code>object</code></p>
  
  <pre><code>{
    ...
    ...
  }
  </code></pre>