0
enter code here

MongoError: failed to connect to server [96:27017] on first connect [MongoError: connect ETIMEDOUT 218.93.250.18:27017] at Pool. (C:\Users\shubham\Desktop\chato\node_modules\mongodb-core\lib\topologies\server.js:336:35) at emitOne (events.js:116:13) at Pool.emit (events.js:211:7) at Connection. (C:\Users\shubham\Desktop\chato\node_modules\mongodb-core\lib\connection\pool.js:280:12) at Object.onceWrapper (events.js:317:30) at emitTwo (events.js:126:13) at Connection.emit (events.js:214:7) at Socket. (C:\Users\shubham\Desktop\chato\node_modules\mongodb-core\lib\connection\connection.js:187:49) at Object.onceWrapper (events.js:315:30) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at emitErrorNT (internal/streams/destroy.js:64:8) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9)

6
  • You need to have mongodb server running for this... Commented Jan 28, 2018 at 15:46
  • no do we need mongoDb server to run?coz m storing data on mongolab Commented Jan 28, 2018 at 15:48
  • Then check the configuration for mongolab. Clearly 96:27017 is not a correct Mongo lab url Commented Jan 28, 2018 at 15:50
  • mongodb://<dbuser>:<dbpassword>@ds145293.mlab.com:45293/chaton Commented Jan 28, 2018 at 15:55
  • this is correct url there in no issue with url also Commented Jan 28, 2018 at 15:55

2 Answers 2

1
//step1)
sudo npm install mongodb@latest

//step2)
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen

//step3)
sudo apt-get update

//step4)
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse

//step5)
sudo apt-get install MongoDB

//step6)
nodemon serve

hopefully, it solved the same error I am facing while working on Angular8 with Nodejs and using MongoDB as a database.

for fetching above steps I followed these links:

Sign up to request clarification or add additional context in comments.

Comments

0

Exactly!! this is the correct url mongodb://:@ds145293.mlab.com:45293/chat‌​on

But.. Did you replace <dbuser> and <dbpassword> with the db user login. Note: I am not talking about the Mongolab login. Inside the Mongo lab there should be an option to add users for the DB named chaton and those credentials like dbuser and dbpassword should be replaced. For example: User:admin password:password Now the url will be like : mongodb://admin:[email protected]:45293/chat‌​on

Hope you got clarified :)

2 Comments

Yeah i have done exactly this before still it is giving me error
Are you behind a proxy?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.