MongoDB
 sql >> Base de Dados >  >> NoSQL >> MongoDB

Simples PHP mongoDB Username and Password Check for site


Algo assim:
$mongo = new Mongo();
$db = $mongo->dbname;    

$user = $db->collection->findOne(array("username" => $username, "password" => $password));
if ($user->count() > 0)
    return $user;
return null;

Ou:
$user = $db->collection->findOne(array("username" => $username, "password" => $password));
$user->limit(1);
if ($user->count(true) > 0)
    return $user;
return null;