title: Adding Some Extra calculation during the time of Sum on mongodb $sum function
body: <p>My Mongo-Db dataset is this: </p>
  
  <pre><code>{
      "_id" : ObjectId("5a267533754884223467604a"),
      "user_id" : "5a20ee1acdacc7086ce7742c",
      "tv_count" : 1,
      "ac_count" : 0,
      "fridge_count" : 0,
      "blower_count" : 0,
      "chair_count" : 0,
      "sofa_count" : 0,
      "D2H_count" : 2,
      "lastmodified" : ISODate("2017-12-05T10:30:30.559Z"),
      "__v" : 0
  }
  </code></pre>
  
  <p>So I know i want to do some modification during the time of Sum.
  My Sum Code is this: </p>
  
  <pre><code>Accessories.aggregate([
                  {$match: { "lastmodified":{$gt: newTime}}},
                  { 
                      $project: {
                          total: { 
                              $add: [ "$tv_count", "$ac_count", "$fridge_count", "$blower_count", "$chair_count", "$sofa_count", "$D2H_count"]
                          }
                      }
                  }
              ]);
  </code></pre>
  
  <p>So it will return the result </p>
  
  <pre><code>[ { _id: 5a267533754884223467604a, total: 3 } ]
  </code></pre>
  
  <p>Now I want to do some extra calculation. Example is</p>
  
  <pre><code>Earlier Result will be 1+0+0+0+0+0+2 = 3
  
  My desire result will be like (1*2)+0+0+0+0+0+(2*4) = 10
  </code></pre>
  
  <p>Any Help will be appreciated.</p>