I have the following code:
$this->connection = new MongoClient($uri, $options);
$this->database = $database;
However, at line $this->connection I get:
Fatal error: Uncaught exception 'MongoConnectionException' with message 'Failed to connect to: /tmp/mongodb-27017.sock:0: Connection refused' in...
If I output the following:
var_dump($uri, $options); exit;
I get:
string(33) "mongodb:///tmp/mongodb-27017.sock" array(1) { ["connect"]=> bool(true) }
This is in my dev environment, I'm not using any username/password for Mongo as I can login to the Mongo shell with mongo reputation alone. From there I can view collection and documents.
Originally I was getting Permissions denied, but I changed the permissions of my dev /tmp/mongodb-27017.sock to 777. Now I get "connection refused".
Anyway below is the file from my ll /tmp/ dir:
srwxrwxrwx 1 mongodb mongodb 0 Jan 28 07:47 mongodb-27017.sock=
Anyone know what the issue is, or how I can debug further? Thanks
drwxrwxrwt 7 root root 20480 Jan 28 08:17 tmp/$optionsand just use$this->connection = new MongoClient($uri);?