Connection with mongoDB

What happened?
when I run mongod I can access normally through the shell and mongoDbCompass
but my node application does not grant access
and it shows this error

MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
at Connection.openUri (C:\nodeTeste\node_modules\mongoose\lib\connection.js:825:32)

What have you already done to try to solve it?
ran the command => mongod --ipv6
oh yes, my node application can access the database and fetch data … but the database does not appear in the shell or in mongoDbCompass
and I can’t even access the banks I see in mongoDbCompass
it looks like it’s creating a bank somewhere else

Try with mongodb://

thanks a lot it worked i was trying localhost .
I’ve been trying for 5 hours lol

1 Like

A recent change in the DNS resolver library (unrelated to MongoDB) where entries from /etc/hosts were sorted before and are now not sorted anymore resolves localhost to its IPv6 flavor ::1 rather than IPv4