Mongoose connection error: MongoError: failed to connect to server Mongoose connection error: MongoError: failed to connect to server mongoose mongoose

Mongoose connection error: MongoError: failed to connect to server


Probably the upgrade was not successful, and the restart of the mongod service failed.View the logs in /var/log/mongodb/mongod.log and check for any inconsistency in the mongod.conf.

Check if the service is up and if it is listening on port 27017.

service mongod statusnetstat -tl | grep 27017 # or using the ss commandss -tl | grep 27017

From the official documentation:

Starting in MongoDB 3.6, mongod and mongos instances bind to localhost by default. Remote clients cannot connect to an instance bound only to localhost. To override and bind to other ip addresses, use the net.bindIp configuration file setting or the --bind_ip command-line option to specify a list of ip addresses.

Try the following setting to enable the service to listen on all the interfacesnet: port: 27017 bindIp: 0.0.0.0