Okay, I see. I asked the sysadmin to update (from 1.2.10).
'aggregate' => 'userdata',
'pipeline' => array( // your query )
Now I run:
$users = $db->command(array(
'aggregate' => 'userdata',
'pipeline' => array(
array('$group' => array('_id' => 'username', 'u_c' => array('$sum' => 1))),
array('$match' => array('u_c' => array('$gt' => 1)))
)
));
foreach($users as $user){
print_r($user);
}
Shows:
Array
(
[0] => Array
(
[_id] => username
[u_c] => 269170 // What is the number of all user
)
)
So how to get the results correctly? There are at least 2 documents with same username.