3

Revising this question following more attempts:

I'm deploying a Meteor app on Galaxy for the first time and cannot connect to MongoDB Atlas.

I can connect to MongoDb through Mongo Shell using:

mongo "mongodb://host1:27017,host2:27017,host3:27017/<db_name>?replicaSet=<replica_set_name>" --ssl --authenticationDatabase admin  --username <username> --password <password>

I tried an equivalent for the Mongo URL in my settings.json:

mongodb://<username>:<password>@host1:27017,host2:27017,host3:27017/<db_name>?authSource=admin&replicaSet=<replace_set_name>

But when I deploy my app, I get:

Error: Could not locate any valid servers in initial seed list.

I've also tried using the connection string provided by Atlas:

mongodb+srv://<username>:<password>@<host>/<db_name>?retryWrites=true&w=majority

But this just returns:

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

I've tried every combination I can come up with but no luck.

RESOLVED, WITH HELP FROM MONGODB ATLAS SUPPORT: "MONGO_URL": "mongodb://:@host1:27017,host2:27017,host3:27017/?ssl=true&replicaSet=&authSource=admin&retryWrites=true&w=majority",

Bren
  • 273
  • 1
  • 18
  • Is there a part in the galaxy guide that explicitly states to omit anything in the url string? Usually after `.net` the part with `/test` defines the name of the database you will use (similar to `use test` in the mongo shell). In the first example you used `/test` and later you wrote `/projectname`. Are you sure you are using the correct database name? Edit: so what about using `mongodb://username:password@projectname-sidh5.mongodb.net/test?retryWrites=true&w=majority`? – Jankapunkt Nov 02 '19 at 20:16
  • The docs don’t say to omit everything after .net but forums I have seen say it should be left off. I’ve also seen the port and database name called optional. I tried that variation and returned an error as well. – Bren Nov 02 '19 at 22:30
  • The port is optional if you are using the default port (27017). The database name is required (which may be different from `projectname`. Try connecting to it using the `mongo` command line, or using a tool like NOSqlBooster – Mikkel Nov 03 '19 at 03:25

0 Answers0