I am creating a learning application and need to connect to Atlas MongoDB. I am able to connect from Compass but not able to connect from the application. I am getting an error:
MongooseServerSelectionError: 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.
I have checked the Network Access list and my IP is the only IP listed. It is correct, but is followed by /32 added automatically and there is no way to get rid of it. It can be edited (e.g. /24 or /16) but not deleted. Also I have tried to use
allow access from anywhere
but still get exactly the same error.Here is connection string. The string was provided when creating the database, I have tried it as it shown below and also tried to use application name instead of the cluster name. But result was exactly the same as it mentioned above. Would be highly appreciate for the help. Codeium was not able to assist :)
mongodb+srv://myUserName:myUserPassword@traversyclaster.xxxxx.mongodb.net/?retryWrites=true&w=majority&appName=TraversyClaster