Database
[{"customerName":"John Doe","orders":[{"type":"regular","items":[{"name":"itemA","price":11.1},{"name":"itemB","price":22.2}]},{"type":"regular","items":[{"name":"itemC","price":33.3},{"name":"itemD","price":44.4}]}]}]
Query
db.collection.aggregate([{"$unwind":"$orders"},{"$unwind":"$orders.items"},{"$group":{"_id":"$customerName","total":{"$sum":"$orders.items.price"}}}])