i try to run such code
$collection->group(array('goods_id'=>1, 'server_id'=>1), array('count' => 0, 'ip'=>'', 'date'=>''), 'function (obj, prev) { prev.count++; prev.ip=obj.user_ip; prev.date=obj.time_download }')->sort(array('count'=>1));
without sort works, with sort not work any ideas?
MongoDB does not yet support grouping and ordering in a single query. Until it can, you can do two things: