mern-exercise-tracker-mongodb
mern-exercise-tracker-mongodb copied to clipboard
mongodb is not connecting
please share some details
please share some details mongodb atlas is not connecting. I tired everything.I didn't find anything that can solve this problem even there is nothing in stackoverflow
"Not connecting" is not enough. Do you have any errors in the console? Did you get any output at all?
Are you whitelisted the current IP address?
I have the same Problem. I can connect to MongoDB with compass (same user, same password, same host machine, with the same IP). But it's not possible to connect with the server.js:
const uri = process.env.ATLAS_URI; mongoose.connect(uri, { useNewUrlParser: true, useCreateIndex: true });
ATLAS_URI is filled in .env file in the same directory as server.js
ATLAS_URI=mongodb+srv://-----:[email protected]/test?retryWrites=true&w=majority
Of course with the same user name and passwort as in compass.
I get the following messages:
Server is running on port: 5000
(node:1920) UnhandledPromiseRejectionWarning: Error: querySrv ETIMEOUT _mongodb._tcp.cluster0-lpfdv.mongodb.net
at QueryReqWrap.onresolve [as oncomplete] (dns.js:206:19)
(node:1920) 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:1920) [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.
I whitelisted my WAN IP and any IP: 0.0.0.0/0 (includes your current IP address)
I realy want to learn with this tutorial, but I'm a little bit frustrated.
Can anyone help?
I have the same Problem. I can connect to MongoDB with compass (same user, same password, same host machine, with the same IP). But it's not possible to connect with the server.js:
const uri = process.env.ATLAS_URI; mongoose.connect(uri, { useNewUrlParser: true, useCreateIndex: true });
ATLAS_URI is filled in .env file in the same directory as server.js
ATLAS_URI=mongodb+srv://-----:[email protected]/test?retryWrites=true&w=majority
Of course with the same user name and passwort as in compass.
I get the following messages: Server is running on port: 5000 (node:1920) UnhandledPromiseRejectionWarning: Error: querySrv ETIMEOUT _mongodb._tcp.cluster0-lpfdv.mongodb.net at QueryReqWrap.onresolve [as oncomplete] (dns.js:206:19) (node:1920) 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:1920) [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.I whitelisted my WAN IP and any IP: 0.0.0.0/0 (includes your current IP address)
I realy want to learn with this tutorial, but I'm a little bit frustrated.
Can anyone help? i got the same error. i understand your frustration. How you solved it ???
I have the same Problem. I can connect to MongoDB with compass (same user, same password, same host machine, with the same IP). But it's not possible to connect with the server.js:
const uri = process.env.ATLAS_URI; mongoose.connect(uri, { useNewUrlParser: true, useCreateIndex: true });
ATLAS_URI is filled in .env file in the same directory as server.js
ATLAS_URI=mongodb+srv://-----:[email protected]/test?retryWrites=true&w=majority
Of course with the same user name and passwort as in compass.
I get the following messages: Server is running on port: 5000 (node:1920) UnhandledPromiseRejectionWarning: Error: querySrv ETIMEOUT _mongodb._tcp.cluster0-lpfdv.mongodb.net at QueryReqWrap.onresolve [as oncomplete] (dns.js:206:19) (node:1920) 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:1920) [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.I whitelisted my WAN IP and any IP: 0.0.0.0/0 (includes your current IP address)
I realy want to learn with this tutorial, but I'm a little bit frustrated.
Can anyone help?
I had similar issue, I installed mongodb in my system (ubuntu) using sudo apt-get install mongodb also try killing server manually using - sudo lsof -i :5000 and then kill -9 PID.
above two solutions worked form me.