db.test3.find()
{ "_id" : 1, "results" : [{"result" : {"cost" : [ { "priceAmt" : 100 } ] } } ] }
I tried the following unsucessfully:
db.test3.aggregate({$group : {_id: "", total : {$sum:
$results.result.cost.priceAmt"}}}, {$project: {_id: 0, total: 1}})
{ "result" : [ { "total" : 0 } ], "ok" : 1 }
EDIT
Desired output:
100 // sum of each "priceAmt"