I've got a replicaSet with three nodes. I'm using a connections string of the following format to connect to the replicaSet:
mongodb://user:pass@host_ip_1:port,host_ip_2:port,host_ip_3:port/database?authSource=admin&replicaSet=name_of_replica&readPreference=secondaryPreferred
where host_ip_1
, host_ip_2
, host_ip_3
are IP addresses (e.g., 10.234.3.45
, 46, 47)
I want to create a domain which would hide all these IP addresses and allow me to use the connection string as follows:
mongodb://user:pass@mongo_domain:port/database?...
But I also what such options like readPreference=secondaryPreferred
to be still working.
How can I do this?