Could elaborate the feature request? So it could then be added to the github tracker?
New in version 3.6.
In addition to the standard connection format, MongoDB supports a DNS-constructed seedlist. Using DNS to construct the available servers list allows more flexibility of deployment and the ability to change the servers in rotation without reconfiguring clients.
In order to leverage the DNS seedlist, use a connection string prefix of mongodb+srv:
in place of the mongodb:
string above.
The +srv
indicates to the mongo client that the hostname that follows corresponds to a DNS SRV record. The client driver will then query the DNS for the record to determine the hosts that are running the mongod instances.
For example, to connect to a DNS-listed hostname:
mongodb+srv://server.example.com/
A typical DNS configuration for the connection string above might look something like this:
Record TTL Class Priority Weight Port Target _mongodb._tcp.server.example.com. 86400 IN SRV 0 5 27317 mongodb1.example.com. _mongodb._tcp.server.example.com. 86400 IN SRV 0 5 27017 mongodb2.example.com.
NOTE
The hostnames returned in SRV records must share the same parent domain (in this example, example.com
) as the given hostname.
The DNS seedlist connection string can also provide options as a query string, with a trailing “/?” as in the standard connection string above. However, the +srv
appended to the standard connection string signals the driver to query the DNS for options as a configured TXT record.
Only two options are available for configuration via a TXT record – replicaSet
and authSource
, and only one TXT record is allowed per server. If multiple TXT records appear in the DNS and/or if the TXT record contains an option other than replicaSet
or authSource
, an error will be thrown by the driver.
An example of a properly configured TXT record:
Record TTL Class Text server.example.com. 86400 IN TXT "replicaSet=mySet&authSource=authDB"
In this case, taking into account both the DNS SRV records and the options retrieved from the TXT records, the parsed string will look like:
Options set in a TXT record can be overridden by passing in a query string with the URI. In the example below, the query string has provided an override for the authSource
option configured in the TXT record of the DNS entry above.
The rest of the option string will remain, and we can expect that the resulting URI would look like this (after parse).
NOTE
The mongodb+srv
option will fail if there is no available DNS with records that correspond to the hostname identified in the connection string. In addition, use of the +srv
connection string modifier sets the ssl
option to true
automatically for the connection. This can be overridden by explicitly setting the ssl
option to false
with ssl=false
in the query string.
Supported since 0.14
You can use to test your connection URI: https://github.com/cchantep/RM-SBT-PlaygroundAlso the Atlas tutorial is up-to-date: http://reactivemongo.org/releases/1.0/documentation/tutorial/mongodb-atlas.html
--
You received this message because you are subscribed to the Google Groups "ReactiveMongo - http://reactivemongo.org" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reactivemong...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reactivemongo/83cd196f-684c-4b16-9c1f-fbb189c98ca7n%40googlegroups.com.
Sadly this is an old known bug for MongoDB 3.x ... at Talenteca we are using ReactiveMongo version 0.16.x until we are able to migrate to MongoDB 4.x