This works fine for remote connection on local runs and for deployment to Galaxy.
I have made a more complex replica set setup with Atlas and would like to connect to that database set from local development and in production.
The Atlas url looks like this:
When I deploy to Galaxy, my app connects successfully to the desired Atlas database. However, when I try to set the url locally to the remote database, like I use to with the compose url, my local app instance only connects to my local mongodb with no warnings or errors.
I tried playing around with the option settings in the url, but with no success. Any ideas how I can achieve this?
Yes. Just running the app as development on my local machine.
So I tried: MONGO_URL=myUrlString meteor --settings set-dev.json --port 3000 run
or: export MONGO_URL=myUrlString meteor --settings set-dev.json --port 3000 run
or: export MONGO_URL=myUrlString meteor --settings set-dev.json --port 3000 run
and all variations of this and makes no difference.
I have also tried this on a blank new meteor app just to make sure its not something within my app or settings, but it yields the same result. Again running the remote with a simple Compose mongo string works fine and if I test the Atlas string in MongoChef it does connect. So I’m suspecting it must be something in the Atlas string.
Hmm. That looks like it should work. I vaguely remember that some people were having problems if the password contained “weird” characters (can’t recollect the definition of weird in this context), but if it works elsewhere it’s probably not that.
I also had problems with that before, so I always choose alphanumerics, so that can’t be the case. I’m starting to wonder if the ‘-’ char in the replicaSet name might be causing problems? However I can’t remember selecting this, think it was autogenerated in Atlas setup.
So I’m finding that the problem is definitely with the ‘&’ char in the string.
From Mongodb:
SEMI-COLON SEPARATOR FOR CONNECTION STRING ARGUMENTS
To provide backwards compatibility, drivers currently accept semi-colons (i.e. ;) as option separators.
So when I replace ‘&’ with ‘;’ the var is set and I can do:
echo "$MONGO_URL"
and it gives me the URL up to the first ';'
If I pass the string with ‘&’ the var is not set at all. So how can I set all the options since ‘;’ is only setting the first option? (i.e. /database?ssl=true - and the rest don’t follow) Sorry I’m a noob to bash.