When i am at home i am able to connect to the database and then when i get to school and run the same scripts even after adding my school’s IP address i keep getting an error. I have even added 0.0.0.0/0 in my whitelist on the MongoDB webpage and still get the error at school. I know that the URI i am using in the .env is correct because it works at home. Anyone else get a similar 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. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://www.mongodb.com/docs/atlas/security-whitelist/
at _handleConnectionErrors (/Users/danteschrantz/Desktop/Data Drivers/Web/Student Registration/node_modules/mongoose/lib/connection.js:900:11)
at NativeConnection.openUri (/Users/danteschrantz/Desktop/Data Drivers/Web/Student Registration/node_modules/mongoose/lib/connection.js:851:11)
at async connectDB (/Users/danteschrantz/Desktop/Data Drivers/Web/Student Registration/config/dbConn.js:5:9) { reason: TopologyDescription {
New contributor
Dante Schrantz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1