Meteor: develop on local machine using mongodb on Modulus.io

126 Views Asked by At

I am trying to set the MONGO_URL env variable on my local machine and point it to my mongo db on modulus, so that I can use that database while I'm developing. I have this in a shell script that has this for the first line:

MONGO_URL=$(meteor mongo --url mongodb://gh:[email protected]:27017/myDatabaseID) meteor

But when the script runs, I get this error:

Error: URL must be in the form of: mongodb://user:pass@host:port/dbname

Looks like that's what I've got there to me! I know the string is correct, b/c the database works fine when visit my modulus project URL in my browser. The username and password are very short b/c the first time I tried this, it complained that my string was too long and the host name could only be 63 characters. Is there another way to use that database while I'm developing on my local machine?

1

There are 1 best solutions below

0
On BEST ANSWER

Try putting this on the server side.

Meteor.startup(function(){
  process.env.MONGO_URL =  'mongodb://gh:[email protected]:27017/myDatabaseID';
});