Reputation: 75
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)
Upvotes: 0
Views: 389
Reputation: 201
//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:
Upvotes: 1
Reputation: 557
Exactly!! this is the correct url mongodb://:@ds145293.mlab.com:45293/chaton
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/chaton
Hope you got clarified :)
Upvotes: 0