[17:34:52] <lastshell> Hi, whats the best practices for mongo clients to connect to a mongodb cluster, I reading this doc https://docs.mongodb.com/manual/reference/connection-string/ and there options are use a list of hosts or a dns record with srv, txt
[17:39:34] <GothAlice> There are few universal best practices for systems this complex, and used in such varying environments and for such varying purposes. Boils down to your needs/requirements. Additionally, what services you may already have in place or not (e.g. being confident managing your own DNS), and what additional overhead (deployment complexity, maintenance) these may represent if you do not.
[17:40:54] <GothAlice> My apps are given a connection string in the form mongodb://<random user>:<random password>@<random subdomain>.example.com:<random port>/<random database name> as an environment variable by the Heroku-like hosting environment I’m using.
[17:42:39] <GothAlice> For me, this represents a per-database allocated mongos query router from the cluster, speaking to a sharded replica set. This makes that mongos router (and its DNS, firewalls, etc.) the point of interface with applications. We have not gone the extra step to deploy SRV or TXT style host selection mechanisms.
[17:43:18] <GothAlice> Basically, the applications aren’t particularly aware they’re talking to a shard set, or a replica set, or a mix, at all.