Home

Published

- 1 min read

MongooseServerSelectionError: connect ECONNREFUSED ::1:27017

img of MongooseServerSelectionError: connect ECONNREFUSED ::1:27017

The solution for this is noted below

MongooseServerSelectionError: connect ECONNREFUSED ::1:27017

Solution

   If you are using latest nodejs -v > v17,
 then try updating mongodb url from localhost to 127.0.0.1 This worked for me

 const MONGODB_URL = "mongodb://127.0.0.1:27017";
 /or
 const MONGODB_URL = "mongodb://0.0.0.0:27017"

Try other methods by searching on the site. That is if this doesn’t work