Bug Report
Current Behavior
When attempting to connect to a MongoDB Atlas cluster using the MongoDB for VS Code extension, the connection fails with the following error:
Unable to connect: querySrv ECONNREFUSED _mongodb._tcp.cluster0.lwaglnx.mongodb.net
The exact same connection string works successfully in mongosh. I am able to connect to my MongoDB Atlas M0 cluster without any issues using mongosh, but the VS Code MongoDB extension consistently fails with the error above.
Code/Gist
Connection string (password hidden):
mongodb+srv://thinkyuvraj_db_user:********@cluster0.lwaglnx.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
Expected Behavior/Code
The MongoDB for VS Code extension should successfully connect to the MongoDB Atlas cluster using the same connection string that works in mongosh.
Steps to Reproduce
- Install the MongoDB for VS Code extension.
- Open VS Code.
- Click "Add Connection".
- Paste the MongoDB Atlas SRV connection string.
- Click Connect.
- The extension displays:
Unable to connect: querySrv ECONNREFUSED _mongodb._tcp.cluster0.lwaglnx.mongodb.net
Troubleshooting Performed
- Verified internet connection (
ping google.com successful).
- Verified DNS resolution (
nslookup cluster0.lwaglnx.mongodb.net successful).
- MongoDB Atlas cluster is running (M0 Free Tier).
- Added my IP address in Atlas Network Access.
- Verified database user credentials.
- Reset the database user password.
- Successfully connected using
mongosh with the exact same connection string.
- Deleted and recreated the VS Code connection.
- Restarted VS Code.
Environment
- Operating System: Windows 11
- MongoDB Atlas: M0 Free Tier
- MongoDB Server Version: 8.0.27 (Atlas)
- Mongosh Version: 2.9.2
- Connection Type: MongoDB Atlas (SRV)
- Error:
Unable to connect: querySrv ECONNREFUSED _mongodb._tcp.cluster0.lwaglnx.mongodb.net
Additional Information
The issue appears to be isolated to the MongoDB for VS Code extension. The same Atlas connection string works correctly in mongosh, indicating that the Atlas cluster, credentials, DNS resolution, and network configuration are all functioning correctly.
Bug Report
Current Behavior
When attempting to connect to a MongoDB Atlas cluster using the MongoDB for VS Code extension, the connection fails with the following error:
The exact same connection string works successfully in
mongosh. I am able to connect to my MongoDB Atlas M0 cluster without any issues usingmongosh, but the VS Code MongoDB extension consistently fails with the error above.Code/Gist
Connection string (password hidden):
Expected Behavior/Code
The MongoDB for VS Code extension should successfully connect to the MongoDB Atlas cluster using the same connection string that works in
mongosh.Steps to Reproduce
Troubleshooting Performed
ping google.comsuccessful).nslookup cluster0.lwaglnx.mongodb.netsuccessful).mongoshwith the exact same connection string.Environment
Additional Information
The issue appears to be isolated to the MongoDB for VS Code extension. The same Atlas connection string works correctly in
mongosh, indicating that the Atlas cluster, credentials, DNS resolution, and network configuration are all functioning correctly.