Adding one more answer as the solution is from different contexts:
MongoDb Atlas problem solution
I connected to MongoDB Atlas and whitelisted my machine’s IP by following the below steps:
- Go to the security tab

- Go to the network access tab under the security tab

- Go to the IP whitelist tab

- Enter the IP address of your machine