Ich habe ubuntu 16.04, php7 und mongo.Probleme mit php7 mongo Abfrage findOne
Nach der Aktualisierung des Systems funktioniert mein Code nicht ... Ich habe eine neue Version von PHP.
Vor Update, mein Code war:
// connect
$m = new MongoClient();
// select a database
$db = $m->clients;
// select a collection (analogous to a relational database's table)
$collection = $db->suscriptions;
// Check if exists in DB
$query = array('email' => $email);
$cursor = $collection->findOne($query);
Nach der Aktualisierung ich die Verbindung geändert, wie durch die PHP-Dokumentation angegeben, aber ich kann jede Abfrage nicht tun ... Dies ist mein Code, wenn Ich entferne die letzte Zeile, der Code funktioniert:
// connect
$m = new MongoDB\Driver\Manager("mongodb://localhost:27017");
// select a database
$db = $m->clients;
// select a collection (analogous to a relational database's table)
$collection = $db->suscriptions;
// Check if exists in DB
$query = array('email' => $email);
// Problem
$cursor = $collection->findOne($query);
Können Sie mir helfen? Vielen Dank!
Thank you !!! Funktioniert perfekt! – Miguel