PHP中mongo db中的数组总和
[_id] => MongoId Object (
[$id] => 4fcf2f2313cfcd344500000d
)
[id] => 14
[name] => Aryan Roban
[score] => Array (
[03-06-2012] => 2
[04-06-2012] => 3
[05-06-2012] => 5
[06-06-2012] => 4
)
我需要排列分数数组的总和(总计),这样
[_id] => MongoId Object (
[$id] => 4fcf2f2313cfcd2454500000d
)
[id] => 14
[type] => Football
[score] => Array (
[03-06-2012] => 2
[04-06-2012] => 3
[05-06-2012] => 5
[06-06-2012] => 4
)
[total] => 14
这要对类型为 Football 的每条记录执行。
怎么做?