0

When I run my code, which should connect my database to my node server, nothing works out.

Here is the output I recieve.

Server is running on port: 5000
(node:1628) UnhandledPromiseRejectionWarning: 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://docs.atlas.mongodb.com/security-whitelist/
    at NativeConnection.Connection.openUri (C:\Users\aharn\Documents\EXERCISE-TRACKER\mern-exercise-tracker\backend\node_modules\mongoose\lib\connection.js:830:32)
    at Mongoose.connect (C:\Users\aharn\Documents\EXERCISE-TRACKER\mern-exercise-tracker\backend\node_modules\mongoose\lib\index.js:335:15) 
    at Object.<anonymous> (C:\Users\aharn\Documents\EXERCISE-TRACKER\mern-exercise-tracker\backend\server.js:16:10)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)       
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)  
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
(node:1628) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1628) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.  
  • Welcome to Stackoverflow! Please update your question with the desired behavior, specific problems, and code to reproduce it. See: [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) – abestrad Jun 25 '20 at 20:23
  • I think I got this error because I was connected to the internet on my phone. – Aaron Arnold Jun 26 '20 at 01:14

0 Answers0