|
DSN for cluster is defined as a) list of servers b) mongodb+srv. In both cases we get a list of hosts in one DSN, but I would like to create one DSN per host. So from what user gives me from MongoDB Atlas e.g.
mongo "mongodb+srv://cluster0-gc2qe.mongodb.net/test" --username admin
|
mongo "mongodb://cluster0-shard-00-00-gc2qe.mongodb.net:27017,cluster0-shard-00-01-gc2qe.mongodb.net:27017,cluster0-shard-00-02-gc2qe.mongodb.net:27017/test?replicaSet=Cluster0-shard-0" --ssl --authenticationDatabase admin --username admin --password <PASSWORD>
|
I want to rewrite back to:
mongo "mongodb://cluster0-shard-00-00-gc2qe.mongodb.net:27017/test?replicaSet=Cluster0-shard-0" --ssl --authenticationDatabase admin --username admin --password <PASSWORD>
|
mongo "mongodb://cluster0-shard-00-01-gc2qe.mongodb.net:27017/test?replicaSet=Cluster0-shard-0" --ssl --authenticationDatabase admin --username admin --password <PASSWORD>
|
mongo "mongodb://cluster0-shard-00-02-gc2qe.mongodb.net:27017/test?replicaSet=Cluster0-shard-0" --ssl --authenticationDatabase admin --username admin --password <PASSWORD>
|
With Format() on ConnString struct I should be able to just modify the list of ConnString.Hosts and call Format()
|