当我运行我的代码时,应该将我的数据库连接到我的节点服务器,但没有任何结果。
这是我收到的输出。
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.