Friday, 26 May 2017

Not connecting to mLab but connecting locally via mongod

I am trying to connect to this remote DB

mongoURL = mongodb://blahuser:blahpassword@ds019053.mlab.com:19053/my-app

and I get this error:

{ MongoError: failed to connect to server [ds019053.mlab.com:19053] on first connect [MongoError: connection 0 to ds019053.mlab.com:19053 timed out]

I also ran: mongo ds019053.mlab.com:19053 and got this error:

MongoDB shell version v3.4.4
connecting to: ds019053.mlab.com:19053
2017-05-26T10:24:47.108-0400 W NETWORK  [thread1] Failed to connect to 54.198.224.164:19053 after 5000ms milliseconds, giving up.
2017-05-26T10:24:47.109-0400 E QUERY    [thread1] Error: couldn't connect to server ds019053.mlab.com:19053, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed

However, When I run mongod I successfully connect to my local mongoDB and my app loads.

What is going on?

*Note :

I just got a new computer and installed mongoDB via Homebrew from this link: https://treehouse.github.io/installation-guides/mac/mongo-mac.html

I definitely got confused and wasn't exactly sure to save this directory: mkdir -p /data/db

Do I save it at the root of my computer? In node_modules? In every node/mongo project? And I can't find that folder either on my computer. Not sure where it went.



via user2456977

No comments:

Post a Comment