PHP MongoDB driver, exceptions not showing -


hey! writing simplified mongodb class side project. trying create , check if connection has been made (within construct), exceptions not being thrown when connection uri badly formatted. using constants credentials/host information.

the class;

class mongodiy {      private $_mdbc = null;      public function __construct($options = array()) {          try {             $this->_mdbc = new mongodb\client("mongodb://" . mdb_user . ":" . mdb_pass . "@" . mdb_host . ":" . mdb_port . "/" . mdb_name, $options);         } catch (exception $e) {             echo "exception:" . $e->getmessage() . "\n";         }      } } ` 

the dump;

mongodiy object (     [_mdbc:mongodiy:private] => mongodb\client object         (             [manager] => mongodb\driver\manager object                 (                     [uri] => mongodb://<username>:<password>@<dead-ip>:27017/app                     [cluster] => array                         (                         )                  )              [uri] => mongodb://<username>:<password>@<dead-ip>:27017/app             [typemap] => array                 (                     [array] => mongodb\model\bsonarray                     [document] => mongodb\model\bsondocument                     [root] => mongodb\model\bsondocument                 )              [writeconcern] => mongodb\driver\writeconcern object                 (                 )          )  ) 

it doesn't matter information use within uri; returns same result (even when using non-existing ip-address). i've tried other snippets php/mongo projects on github, seems lot of these using deprecated driver (mongo.so instead of mongodb.so) or not catching exceptions @ all.

i appreciate help. thank you!


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -