title: MongoDB Aggregation with sum of array values
body: <p>I have a collection with the following data:</p>
  
  <pre><code>{
      "_id" : ObjectId("5516d416d0c2323619ddbca8"),
      "date" : "28/02/2015",
      "driver" : "user1",
      "passengers" : [
          {
              "user" : "user2",
              "times" : 2
          },
          {
              "user" : "user3",
              "times" : 3
          }
      ]
  }
  {
      "_id" : ObjectId("5516d517d0c2323619ddbca9"),
      "date" : "27/02/2015",
      "driver" : "user2",
      "passengers" : [
          {
              "user" : "user1",
              "times" : 2
          },
          {
              "user" : "user3",
              "times" : 2
          }
      ]
  }
  </code></pre>
  
  <p>And I would like to perform aggregation so that I will know for a certain passenger, times it was with a certain driver, in my example it would be:
  for user1: <code>[{ driver: user2, times: 2}]</code>
  for user2: <code>[{ driver: user1, times: 2}]</code>
  for user3: <code>[{ driver: user1, times: 3}, {driver: user2, times:2}]</code></p>
  
  <p>Im quite new with mongo and know how to perform easy aggregation with sum, but not when its inside arrays, and when my subject is itself in the array.
  what is the appropriate way to perform this kind of aggregation, and in more specific, how I perform it in express.js based server?</p>