mern-exercise-tracker-mongodb icon indicating copy to clipboard operation
mern-exercise-tracker-mongodb copied to clipboard

mongodb is not connecting

Open utshomomen opened this issue 5 years ago • 7 comments

utshomomen avatar Dec 13 '19 11:12 utshomomen

please share some details

bmnidhin avatar Dec 15 '19 17:12 bmnidhin

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

utshomomen avatar Dec 17 '19 15:12 utshomomen

"Not connecting" is not enough. Do you have any errors in the console? Did you get any output at all?

oonqt avatar Dec 22 '19 00:12 oonqt

Are you whitelisted the current IP address?

bmnidhin avatar Dec 26 '19 23:12 bmnidhin

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?

pclade avatar Mar 07 '20 11:03 pclade

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 ???

sohilmomin avatar Mar 19 '20 10:03 sohilmomin

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.

er-nitin-keshaw avatar Jun 16 '20 03:06 er-nitin-keshaw