After I install mongodb on debian/centos how do I get the mongo_url so I can connect my app to my mongodb?

June 24, 2017 488 views
MongoDB CentOS Debian

This is rather a newbie question. Bear with me. After I install mongodb on debian/centos how do I get the mongo_url so I can connect my app to my mongodb?

2 Answers
hansen June 24, 2017
Accepted Answer

@flameuzumo

But your code is separated from the database. Meteor.js just installs MongoDB as part of it's setup.
From what I can see, it's installed on port 3001.

I don't know what mongo_url is, but I guess it's the configuration parameter in Meteor.js, so in that case, it would be mongodb://localhost:27017/myproject or however you have setup your MongoDB - so if you used authentication in the setup, your url changes to mongodb://username:password@localhost:27017/myproject.

You would probably find much better help in the forums of Meteor: https://forums.meteor.com/

  • Thank you I'll direct my questions there.

    • PS: In meteor the db files are in the meteor project directory. So when you delete the project directory the db files are also gone. So they are tightly coupled in a funny way like that. Thank you very much for your help. I think I have enough to start scratching around.

      • It seems like Meteor.js is a easy-to-setup platform for starting JavaScript projects, but with everything included, so when you start a project it automatically creates the databases and all the setup for you. And like you say, it deletes everything connected to that project, when you delete the project.
        If you're not interested in such a platform, then you should probably setup your own Nginx, Node.js and MongoDB, but it would require much more knowledge, so that's why Meteor.js might be a good starting ground until you got a hang of everything.

Hi @flameuzumo
MongoDB is by default listening on localhost port 27017, so your "url" is normally:

localhost:27017
  • Is that it? No other fancy things like I see in the following url: mongodb://username:password@localhost:27017/myproject ?

Have another answer? Share your knowledge.