Can’t connect to MongoDB 6.0 Server locally using Nodejs driver

Problem is, the localhost alias resolves to IPv6 address ::1 instead of 127.0.0.1 However, net.ipv6 defaults to false. The best option would be to start the MongoDB with this configuration: net: ipv6: true bindIpAll: true or net: ipv6: true bindIp: localhost Then all variants should work: C:\>mongosh “mongodb://localhost:27017” –quiet –eval “db.getMongo()” mongodb://localhost:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.0 C:\>mongosh “mongodb://127.0.0.1:27017” –quiet … Read more