11

I'm new to both Meteor.js and MongoDB and after installing Meteor in the official way described I wonder how to connect to my MongoDB.

MongoDB was installed by Meteor during the installation and everything works fine but now I would like to have a look into it with another tool (like RazorSQL) to see what's in there.

But the standard connection parameters (localhost:27017) doesn't work, what can I do? Login? Password?

Connection parameters to MongoDB in RazorSQL

Marc
  • 6,749
  • 9
  • 47
  • 78
  • Marc, [check this answer out](http://stackoverflow.com/questions/10293781/how-do-i-access-meteors-mongodb-from-another-client-while-meteor-is-running). – TimDog Jan 17 '13 at 03:54
  • Thank you, I did and couldn't connect with localhost (see my comment to Akshats answer) but with 127.0.0.1 the connection to port 3002 worked. – Marc Jan 17 '13 at 11:14

2 Answers2

11

Update: February 2014 - Meteor 0.7.1 - The meteor port has been shifted to 3001 instead of 3002. So instead of adding two to the port meteor runs on, you add 1 instead.

MongoDB's database is installed in the meteor package containing your files in a hidden folder called .meteor. To access it from a remote tool simply add 2 to whatever your web server port is while meteor is running. It will be stored in the meteor database

e.g http://localhost:3000 would have its mongodb server running at mongodb://localhost:3002/meteor there is no username/password on this instance if you ran it with meteor or meteor run

JohnAllen
  • 7,317
  • 9
  • 41
  • 65
Tarang
  • 75,157
  • 39
  • 215
  • 276
  • Thank you very much, that helped! Odd behaviour: Meteor has been started with `localhost:3000` but to connect to the MongoDB `localhost` did not work (connection refused) but `127.0.0.1` did. And port number `3002` was correct. – Marc Jan 17 '13 at 11:12
  • Be AWARE: The collections may look empty, you would need to make an insert in order to see the data. – Ruben Aug 08 '17 at 05:02
5

To get the Meteor Mongo url and port, first run your Meteor app using meteor run then run meteor mongo in a different terminal tab. You should see an output like this

[meteor-app] meteor mongo
MongoDB shell version: 2.6.7
connecting to: 127.0.0.1:3001/meteor

this means that your Meteor Mongo is running at 127.0.0.1:3001.

If you are running your Meteor app with meteor run then you neither need username/password nor authentication configuration just make sure that you set your default database name as meteor

Fatih Acet
  • 28,690
  • 9
  • 51
  • 58