mongoose: Error when trying to connect to db.

Prerequisites

  • I have written a descriptive issue title

Mongoose version

6.6.0

Node.js version

18.x

MongoDB version

5.0.12

Operating system

Windows

Operating system version (i.e. 20.04, 11.3, 10)

10

Issue

So when I try to connect to my db I have an error

Error: querySrv ECONNREFUSED _mongodb._tcp.cluster0.0ltupff.mongodb.net
    at QueryReqWrap.onresolve [as oncomplete] (node:dns:303:19) {      
  errno: undefined,
  code: 'ECONNREFUSED',
  syscall: 'querySrv',
  hostname: '_mongodb._tcp.cluster0.0ltupff.mongodb.net'
}

link that I use to connect is

mongodb+srv://<username>:<password>@cluster0.0ltupff.mongodb.net/Cluster0?retryWrites=true&w=majority

And yes, I have a correct username and password. My IP is allowed too.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29

Most upvoted comments

Funny thing, my friend logged in without trouble…