How can I check to see if there was an error with MongoDB?
var_dump($mongodb->lastError());
gives me a blank page.
Mongo::lastError — Check if there was an error on the most recent db operation performed
Deprecated
// NOT WORK!!
$mongo = new Mongo();
var_dump($mongo->lastError());
You only see a blank page because you have error reporting turned off in your PHP configuration.
MongoDB::lastError — Check if there was an error on the most recent db operation performed
You need MongoDB class
// WORK!!
$mongo = new Mongo();
$db = $mongo->database;
var_dump($db->lastError());
$mongo->lastError() --> $db->lastError()
echoorvar_dump? Can we see your full code?