Sesuatu seperti ini:
$mongo = new Mongo();
$db = $mongo->dbname;
$user = $db->collection->findOne(array("username" => $username, "password" => $password));
if ($user->count() > 0)
return $user;
return null;
Atau:
$user = $db->collection->findOne(array("username" => $username, "password" => $password));
$user->limit(1);
if ($user->count(true) > 0)
return $user;
return null;