title: Mongodb Aggregation Query with $sum
body: <p>I have a collection called <code>test</code>. I want to get total amount of one key: <code>sal</code> across all documents present in the <code>test</code> collection. </p>
  
  <p>Here is sample document:</p>
  
  <pre><code>[
      {
      "name": "hari",
      "sal": "100",
      "status": "Y",
      "address": "Bangalore"
      },
      {
      "name": "Sam",
      "sal": "200",
      "status": "Y",
      "address": "Bangalore"
      },
      {
      "name": "Nik",
      "sal": "200",
      "status": "N",
      "address": "Bangalore"
      }
  ]
  </code></pre>
  
  <p>and I tried the following query:</p>
  
  <pre><code>db.getCollection('test').aggregate([{
    $match: {
      Status: "Y"
    }
  }, {
  $group: {
      _id: null,
      total: {
          $sum: "$sal"
      }
    }
  }])
  </code></pre>
  
  <p>I am getting zero. </p>
  
  <p>Can anyone suggest me the right query to add a particular key across all the documents in a collection.</p>