Try to whitelist your IP address from MongoDB Atlas. Use below steps to do it.
- Login to MongoDB Atlas and go to Cluster page.
- Click on Network Access -> Add IP Address -> Add current IP Address.
- Alternatively, to allow access from any IP and save changes.
( Enter 0.0.0.0/0 as the IP address )