Něco takového:
$mongo = new Mongo();
$db = $mongo->dbname;
$user = $db->collection->findOne(array("username" => $username, "password" => $password));
if ($user->count() > 0)
return $user;
return null;
Nebo:
$user = $db->collection->findOne(array("username" => $username, "password" => $password));
$user->limit(1);
if ($user->count(true) > 0)
return $user;
return null;