Class: Mongo::URI::SRVProtocol
- Inherits:
-
Mongo::URI
- Object
- Mongo::URI
- Mongo::URI::SRVProtocol
- Defined in:
- lib/mongo/uri/srv_protocol.rb
Overview
Parser for a URI using the mongodb+srv protocol, which specifies a DNS to query for SRV records. The driver will query the DNS server for SRV records on hostname.domainname, prefixed with _mongodb._tcp The SRV records can then be used as the seedlist for a Mongo::Client. The driver also queries for a TXT record providing default connection string options. Only one TXT record is allowed, and only a subset of Mongo::Client options is allowed.
Please refer to the Initial DNS Seedlist Discovery spec for details.
github.com/mongodb/specifications/blob/master/source/initial-dns-seedlist-discovery
Constant Summary
Constants inherited from Mongo::URI
AUTH_DELIM, AUTH_MECH_MAP, AUTH_USER_PWD_DELIM, DATABASE_DELIM, HELP, HOST_DELIM, HOST_PORT_DELIM, INDIV_URI_OPTS_DELIM, INVALID_OPTS_DELIM, INVALID_OPTS_VALUE_DELIM, INVALID_SCHEME, MONGODB_SCHEME, MONGODB_SRV_SCHEME, PERCENT_CHAR, READ_MODE_MAP, REPEATABLE_OPTIONS, SCHEME, SCHEME_DELIM, UNESCAPED_DATABASE, UNESCAPED_UNIX_SOCKET, UNESCAPED_USER_PWD, UNIX_SOCKET, UNSAFE, URI_OPTS_DELIM, URI_OPTS_VALUE_DELIM
Constants included from Loggable
Instance Attribute Summary
Attributes inherited from Mongo::URI
#options, #servers, #uri_options
Instance Method Summary collapse
-
#client_options ⇒ Hash
Gets the options hash that needs to be passed to a Mongo::Client on instantiation, so we don’t have to merge the txt record options, credentials, and database in at that point - we only have a single point here.
Methods inherited from Mongo::URI
#credentials, #database, get, #initialize
Methods included from Loggable
#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger
Constructor Details
This class inherits a constructor from Mongo::URI
Instance Method Details
#client_options ⇒ Hash
Gets the options hash that needs to be passed to a Mongo::Client on instantiation, so we don’t have to merge the txt record options, credentials, and database in at that point - we only have a single point here.
48 49 50 51 52 |
# File 'lib/mongo/uri/srv_protocol.rb', line 48 def opts = @txt_options.merge(ssl: true) opts = opts.merge().merge(:database => database) @user ? opts.merge(credentials) : opts end |