MongoDB
 sql >> Database >  >> NoSQL >> MongoDB

Simple PHP mongoDB Nome utente e password Verifica il sito

Qualcosa del genere:

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

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

Oppure:

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