Hello community,
I am working on the ExpressJS web services project. We have created a free cluster in MongoDB Atlas and I am trying to connect to the DB using the connection string provided by the website itself (mongodb+srv://:@cluster0.0jqio.mongodb.net/?retryWrites=true&w=majority). I have whitelisted my own IP and made it accessible from anywhere as well.
Sometimes it is connected but sometimes it gives me error “Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you’re trying to access the database from an IP that isn’t whitelisted. Make sure your current IP address is on your Atlas cluster’s IP whitelist: https://www.mongodb.com/docs/atlas/security-whitelist/”.
But I do not think that is the issue as I was able to connect to the cluster using my MongoDB Compass, Mongosh and VS Code MongoDB extension.
Skip to main content
Hello @Tien_Pham1 … If you can consistently, every time, connect via Compass, Mongosh, and VSCode and only experience failures in your application coded using ExpressJS, then there is either a bug in your application code or in ExpressJS itself.
New & Unread Topics
Topic | Replies | Views | Activity |
---|---|---|---|
configuration file options in Atlas | 1 | 203 | Jul 2024 |
Using cluster for live data and archive for reporting | 0 | 83 | Aug 2024 |
Divergent data when using projection | 1 | 86 | Aug 2024 |
error while connecting to mongo atlas using aws lambda | 0 | 47 | Sep 2024 |
Do Atlas Invoices provide a per cluster cost breakdown? | 1 | 36 | Dec 2024 |