Prasanga Thapaliya
Prasanga Thapaliya

Reputation: 737

Error while connecting NodeJS with MongoDB

I was saving and retrieving data in MongoDB using NodeJS. It was working properly. Now suddenly, it has started to display the following error message in the console. If I restart the NodeJS server then, again sometimes it works. How to fix this. Is this error related to MongoDB or mongoose itself? I am using mongoose "mongoose": "^5.12.11", and MongoDB driver version NodeJS 3.6 or later in MongoDB Atlas.

Error: querySrv ECONNREFUSED _mongodb._tcp.socail.xngew.mongodb.net
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:203:19) {
  errno: undefined,
  code: 'ECONNREFUSED',
  syscall: 'querySrv',
  hostname: '_mongodb._tcp.socail.xngew.mongodb.net'
}

Upvotes: 0

Views: 63

Answers (1)

Ishan Anuradha
Ishan Anuradha

Reputation: 51

Downgrading the node version will be the solution for your issue. You can find more details from here

Upvotes: 1

Related Questions