title: Mongoose, Node.js get sum of a field from a bunch of documents
body: <p>I have this mongoose method/query which finds all 'incomes' from a certain user but only if the dates of the 'incomes' are within the current month.</p>
  
  <p>Code:</p>
  
  <pre><code>module.exports.getMonthlyIncome = function(userId, callback){
  const now = new Date();
  
  const year = now.getFullYear();
  const month = now.getMonth();
  const date = now.getDate();
  
  const start = new Date(year, month, 1);
  const end = new Date(year, month, 30);
  
  Income.find({owner: userId, date: { $gte: start, $lt: end }}, callback);
  }
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>[
  {
  
  "_id": "58cc9ee50fe27e0d2ced5193",
  "amount": 600,
  "description": "Ripco Salary",
  "owner": "58cc9e950fe27e0d2ced5192",
  "__v": 0,
  "date": "2017-03-17T00:00:00.000Z"
  },
  
  {
  
  "_id": "58ccc3cfca6ea10980480d42",
  "amount": 450,
  "description": "Another Ripped co salary",
  "owner": "58cc9e950fe27e0d2ced5192",
  "__v": 0,
  "date": "2017-03-26T00:00:00.000Z"
  }
  
  ]
  </code></pre>
  
  <p>Result is as expected, gives me the 2 income documents belonging to a certain user during the month.</p>
  
  <p>Now, I want to get the total sum of every 'amount' field from these documents.</p>
  
  <p>So in this case, the sum would be 1050.</p>
  
  <p>How would I achieve this in Mongoose?</p>
  
  <p>Any help is greatly appreciated, cheers.</p>