Downgrade to a lower version like 3.6.17, 4.0.0 etc.
uninstalled previous mongodb and reinstalled new one.
Mongo shell allows me to connec to DB Easily, even query on collections, GUI tools like ROBO3T also able to make connection without an error.
4 . Used sudo service mongod restart, Service is uo and running
My node js code is fine as others not facing any issue with the code.Previously it was working fine suddenly it starting throwing this error.
Please help me on this, as this error really stalls my development.
Based on the error message it looks like your application is trying to connect to a local MongoDB server that is currently not running.
I would definitely work out the issue with your current MongoDB installation rather than changing server versions (which would require following the relevant upgrade or downgrade steps).
What specific versions of MongoDB server, Node.js driver, and Node.js are you using?
To be clear: you are able to connect to localhost:27017 from the same environment as your application using the mongo shell and other admin tools?
Thanks for reply
Yes, i am able to connect with mongo on mongo shell and following versions, i am using on my system.
MongoDB verison
db version v4.4.0
Node Version
v8.14.0
Following are the packages of mongo i am using, from package.json
“mongo-heartbeat”: “~1.0.0”,
“mongodb”: “^3.5.2”,
“mongodb-core”: “^2.1.17”,
“mongoose”: “^5.0.9”,