PHP+MongoDB: Uncaught exception 'MongoCursorException' with message 'No such file or directory' PHP+MongoDB: Uncaught exception 'MongoCursorException' with message 'No such file or directory' mongodb mongodb

PHP+MongoDB: Uncaught exception 'MongoCursorException' with message 'No such file or directory'


Check the error code $e->getCode(); using:

    try {        User::$_users_collection->update($query, array('$set' => $data), $options);    } catch (MongoCursorException $e) {    echo "error message: ".$e->getMessage()."\n";    echo "error code: ".$e->getCode()."\n";    }

And than with the error code check the list of Mongo Cursor exception errors: http://www.php.net/manual/pt_BR/class.mongocursorexception.php

For example if you got error code 3 "This may indicate you are out of RAM or some other extraordinary circumstance.".

note: avoid the use of safe option, is deprecated. Use the WriteConcern w option, will provite more option too.

About the error:"Caused by accessing a cursor incorrectly or a error receiving a reply.Any operation that sends information to the database and waits for a response can throw a MongoCursorException. The only exception is new MongoClient() (creating a new connection), which will only throw MongoConnectionExceptions." (http://php.net/manual/en/class.mongocursorexception.php)


hard to know where it happens, but this pageexplains in detail what can cause this exception