MongoDB無法獲得總數。PHP mongodb總和查詢
MYSQL:
select sum(play) as toplam from videos
的MongoDB:
$group = $naytu->db->videos->group(array(), array("toplam" => 0), "function(obj, prev) {prev.toplam = prev.toplam + obj.play - 0;}");
結果(的print_r)
Array
(
[retval] => Array
(
[0] => Array
(
[toplam] => NAN
)
)
[count] => 78656
[keys] => 1
[ok] => 1
)
問題出在哪裏?
謝謝:)好的! :) – user3342378