New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nodejs v18 gives: MongooseServerSelectionError: connect ECONNREFUSED ::1:27017 #12134
Comments
Connection attempt was to a local MongoDB instance. Exception/Stack trace was
|
Node18 uses ipv6 natively. So you should not use localhost but use the IP explicitly. |
Are you using Another alternative would be to configure your MongoDB server to accept ipv6 connections |
I am facing the same problem and none of the solutions are working |
@KrunalTarale please open a new issue and follow the issue template. |
Prerequisites
Mongoose version
6.4.6
Node.js version
81.x
MongoDB server version
6.0
Description
If I'm using NodeJS 16.x everything works fine.
If I upgrade NodeJS to 18.x I get an error trying to connect to MongoDB:
MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
Nothing else different except NodeJS version.
Any ideas why mongoose connections fail with NodeJS 18, but are fine with 16?
Steps to Reproduce
Change to NodeJS 18
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: