1

No suitable servers found (serverselectiontryonce set): [Failed connecting to '127.0.0.1:27107': Connection refused]

I install "jenssegers/mongodb": "^3.0" using composer, but am getting error, i can't connect mongodb.

bala.alab
  • 66
  • 4

3 Answers3

1

I got this error when I had mistaken the IP of my machine. I was in VM and used 127.0.0.1, when I needed to use 10.0.2.2, IP of my host machine. Wasted an hour for this. Maybe it saves someone's time...

Rav
  • 1,460
  • 1
  • 21
  • 33
0

According to MongoDB documentation

mongod is the primary daemon process for the MongoDB system

According to above mentioned description ,it seems that mongod process is not running on your server and 27017 is default port for mongod instance

Please try executing following command to verify if mongod process is running on server

pgrep mongod

It will return process ID if mongod process is running on server otherwise nothing.

Issue following command in shell to start mongod process

mongod --noauth --dbpath /var/lib/mongodb
Rubin Porwal
  • 3,736
  • 1
  • 23
  • 26
0

I had this error. I had to restart mongodb to make this work.

I used the command below

sudo service mongod restart
Moh .S
  • 1,920
  • 19
  • 19