How to connect a local meteor instance to a remote mongodb

Hey guys,

I’ve been looking for this and I’m not seeing how to do it.

How do I simply run a local instance of a Meteor app but have it connect to a remote MongoDB?

This would be for a non-NPM version of Meteor.

Alright easy enough.

for a non-NPM Meteor:

if your connectionString is

MONGO_URL=mongodb://[username]:[password]@server:10170/[database]

then in the terminal do

$ MONGO_URL=connectionString meteor

and then you can run meteor and it will connect to the remote db

of course you can just export the mongourl and just run meteor

$ export MONGO_URL=connectionString

If you’re using an NPM version of meteor, you can save the connection string into a file

In the package.json file:

"scripts": {"meteor": "MONGO_URL=mongodb://[username]:[password]@server:10170/[database] meteor"}

then do

$ npm run meteor
2 Likes