Why am I getting "Call to undefined function findOne()" here?
I've got a little PHP script that has the following code in it:
$m = new MongoClient(Settings::$db);
$db = $m->db;
// get the 'customers' collection
$customers = $db->customers;
// determine if this customer already exists
$c = $customers.findOne(array('email' => $email)); <--- throws
if (is_null($c)) {
$customers.insert(array(
'email' => $email,
'firstname' => $firstName,
'lastname' => $lastName
));
}
// get the 'payments' collection
$payments = $db->payments;
// add a record
$payments->insert(array(
'email' => $email,
'firstname' => $firstName,
'lastname' => $lastName,
'amount' => $price,
'token' => $token
));
but it's throwing the error:
PHP Fatal error: Call to undefined function findOne() in ...
Now, I've downloaded and copied into the ext directory the php_mongo.dll
file. Further, I've added this line to the php.ini:
extension=php_mongo.dll
and I've since rebooted the server numerous times.
It really feels to me like this findOne method isn't available because the
php_mongo extension isn't loaded. But on the other hand, it's not throwing
when creating the MongoClient, nor is it throwing when grabbing the
database and the collection.
What's going on here?
No comments:
Post a Comment