Я пытаюсь использовать структуру агрегации для выполнения подсчета групп в монго, но результаты не так точно ожидаются. Рассмотрим сборник $people->insert(array("user_id" => "1", "day" => "Monday", 'age' => 18)); $people->insert(array("user_id" => "3", "day" => "Monday", 'age' => 24)); $people->insert(array("user_id" => "1", "day" => "Monday", 'age' => 18)); $people->insert(array("user_id" => "1", "day" => "Monday", 'age' => 18)); […]
Пожалуйста, рассмотрите сборник ниже $people->insert(array("user_id" => "1", "day" => "Monday", 'age' => 18)); $people->insert(array("user_id" => "3", "day" => "Monday", 'age' => 24)); $people->insert(array("user_id" => "1", "day" => "Monday", 'age' => 18)); $people->insert(array("user_id" => "1", "day" => "Monday", 'age' => 18)); $people->insert(array("user_id" => "2", "day" => "Monday", 'age' => 25)); $people->insert(array("user_id" => "4", "day" => "Monday", […]