0

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'
}

Prasanga Thapaliya
  • 657
  • 1
  • 8
  • 19

1 Answers1

1

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