How to set up external Mongo DB with Meteor

Meteor is an excellent platform for reactive web applications. It supports Mongo DB as its primary Data Store layer. It comes with local database for development purpose. But for a real production deployment as in most of the cases, a remote database needs to be associated with the application. Meteor reads MONGO_URL parameter from PATH to determine if it needs to start a local database.

Important factor here is to point MONGO_URL to correct Mongo DB instance.

If your MONGO DB port is 27017, you can skip port in below URLs.

  1. Linux:
    export MONGO_URL=mongodb://youraddress:port/yourDB

  2. Windows
    Go Computer->Advanced-> Environment Variables
    set
    MONGO_URL mongodb://yourdbaddress:port/yourDB

  3. Heroku
    heroku config:set MONGO_URL=mongodb://yourdbaddress:port/yourDB

You should get success message something like this

Setting MONGO_URL and restarting ⬢ <appname>... done, v10  
MONGO_URL: mongodb://yourdbaddress:port/yourDB  

Hopefully it is helpful.