Connect Meteor at external Mongo Database

Hi at All!

i have external mongo database on mLAb.

I need to connect my meteor application at remote database.

I read a lot online but I do not understand how to do it

Please, can someone help me?


Hi @luca1982, You can use the MONGO_URL environment variable to define which MONGO Database should be used by your Meteor App. Refer to=>

I have not used mLab, I think it should be something like

=> refer to , Step 3 in the Quick Start Guide.

Select a datacenter in mlab where your meteor application is hosted. Then mlab will provide you a connection string. Use that connection string as your MONGO_URL when you start your meteor app.

thanks for your reply!
in the mlab account i have copied the connection string. But how should I write MONGO_URL the string in meteor ? In the server mail.js in the Meteor.isStart?


Hi @luca1982, I hope you are running your meteor application using the command “meteor” from the command line. You need to set the MONGO_URL environment variable before running your application. You need to do it in the same Command-line session so that the environment variables is effective. Here is how you can set the MONGO_URL environment variable.

In Windows: should help.

In Mac:

  1. In the terminal, type "export MONGO_URL=“mongodb://<dbuser>:<dbpassword>” and press Enter.
    You should use the connecting string from mlab instead of the example text in bold
  2. You can then type “export” and it will show the currently set Environment variables. You can verify if MONGO_URL is setup properly.
  3. Type “meteor” and press Enter.
    Enjoy your local Meteor App connected to the remote Mongo DB from mlab.