MongoDb Manager for users should not fail when Mongo primary is down

I am working on a project Zend3. when ever project load session will save in MongoDB. (\Zend\Session\SaveHandler\MongoDB)

‘session_storage’ => [
‘type’ => Session\Storage\SessionArrayStorage::class,
Session\SaveHandler\MongoDB::class => [
MongoDBFactory::CONF_COLLECTION_NAME => ‘sessions’,

The problem is when MongoDB primary is down, we got an error.
How can solve this?


Hello and welcome to our forums! :smiley:

The question is: How should the session work if the handler is not running?
Maybe this can be handled in a custom save handler that catches the error and provides an alternative.

Thanks @froschdesign ,
I saved the session in Memcached. That problem by session is solved but,

I got this kind of errors (Display on page as a warning)For most pages

Warning: Uncaught MongoDB\Driver\Exception\CommandException
Db\Mongo\Database\MongoDbDatabase::command: Could not find host matching read preference { mode: “primary” } for set uat_db

This cause some where by (\MongoDB::command) or (\MongoDB\Driver\Server::executeCommand)

Is there any option that primary mongo is down and website work(for pages that will write in mongo)?
As I know it must work for pages that read from MongoDB Collection.

Also the website is really slow and it takes more time to load after primary is down. Is it related?