-
Notifications
You must be signed in to change notification settings - Fork 533
RUBY-1559 Implement uri option spec tests #1170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
7910476
f57decb
ffc3704
7355473
e396935
2fefd93
61066ca
80fcbe7
c0e34b9
e9de6b7
729a3ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,12 +76,12 @@ Since the URI options are required in camel case, which is not the Ruby standard | |
| following table shows the option in the URI and its corresponding option if passed | ||
| to the constructor in Ruby. | ||
|
|
||
| .. note:: | ||
| .. note:: | ||
|
|
||
| The options passed directly should be symbols. | ||
|
|
||
| The options are explained in detail in the :manual:`Connection URI reference | ||
| </reference/connection-string/>`. | ||
| </reference/connection-string/>`. | ||
|
|
||
| .. note:: | ||
| Options that are set in **milliseconds** in the URI are | ||
|
|
@@ -97,8 +97,23 @@ URI Options Conversions | |
| * - URI Option | ||
| - Ruby Option | ||
|
|
||
| * - replicaSet=String | ||
| - ``:replica_set => String`` | ||
| * - appName=String | ||
| - ``:app_name => String`` | ||
|
|
||
| * - authMechanism=String | ||
| - ``:auth_mech => Symbol`` | ||
|
|
||
| * - authMechanismProperties=Strings | ||
| - ``{ :auth_mech_properties => { :service_realm => String, :canonicalize_host_name => true|false, :service_name => String } }`` | ||
|
|
||
| Specified as comma-separated key:value pairs, e.g. ``"SERVICE_REALM:foo,CANONICALIZE_HOSTNAME:TRUE"`` | ||
|
|
||
| * - authSource=String | ||
| - ``:auth_source => String`` | ||
|
|
||
| * - compressors=Strings | ||
| - ``:compressors => Array<String>`` | ||
| Specified as a comma-separated list, e.g. "zlib,snappy" | ||
|
||
|
|
||
| * - connect=String | ||
| - ``:connect => Symbol`` | ||
|
|
@@ -109,56 +124,81 @@ URI Options Conversions | |
| * - connectTimeoutMS=Integer | ||
| - ``:connect_timeout => Float`` | ||
|
|
||
| * - socketTimeoutMS=Integer | ||
| - ``:socket_timeout => Float`` | ||
| * - fsync=Boolean | ||
| - ``{ :write => { :fsync => true|false }}`` | ||
|
|
||
| * - serverSelectionTimeoutMS=Integer | ||
| - ``:server_selection_timeout => Float`` | ||
| * - heartbeatFrequencyMS=Integer | ||
| - ``:heartbeat_frequency => Float`` | ||
|
|
||
| * - journal=Boolean | ||
| - ``{ :write => { :j => true|false }}`` | ||
|
|
||
| * - localThresholdMS=Integer | ||
| - ``:local_threshold => Float`` | ||
|
|
||
| * - maxIdleTimeMS=Integer | ||
| - ``:max_idle_time => Float`` | ||
|
|
||
| * - maxPoolSize=Integer | ||
| - ``:max_pool_size => Integer`` | ||
|
|
||
| * - minPoolSize=Integer | ||
| - ``:min_pool_size => Integer`` | ||
|
|
||
| * - waitQueueTimeoutMS=Integer | ||
| - ``:wait_queue_timeout => Float`` | ||
| * - readPreference=String | ||
| - ``{ :read => { :mode => Symbol }}`` | ||
|
|
||
| * - w=Integer|String | ||
| - ``{ :write => { :w => Integer|String }}`` | ||
| * - readPreferenceTags=Strings | ||
| - ``{ :read => { :tag_sets => Array<Hash> }}`` | ||
|
|
||
| * - wtimeoutMS=Integer | ||
| - ``{ :write => { :wtimeout => Float }}`` | ||
| Each instance of the readPreferenceTags field is a comma-separated key:value pair which will appear in the :tag_sets array in the order they are specified. For instance, ``"readPreferenceTags=dc:ny,rack:1&readPreferenceTags=dc:ny"`` will be converted to ``[ { 'dc' => 'ny', 'rack' => '1' }, { 'dc' => 'ny' }]``. | ||
|
|
||
| * - journal=Boolean | ||
| - ``{ :write => { :j => true|false }}`` | ||
| * - replicaSet=String | ||
| - ``:replica_set => String`` | ||
|
|
||
| * - fsync=Boolean | ||
| - ``{ :write => { :fsync => true|false }}`` | ||
| * - serverSelectionTimeoutMS=Integer | ||
| - ``:server_selection_timeout => Float`` | ||
|
|
||
| * - readPreference=String | ||
| - ``{ :read => { :mode => Symbol }}`` | ||
| * - socketTimeoutMS=Integer | ||
| - ``:socket_timeout => Float`` | ||
|
|
||
| * - readPreferenceTags=Strings | ||
| - ``{ :read => { :tag_sets => Array<String> }}`` | ||
| * - tls=Boolean | ||
| - ``:ssl => boolean`` | ||
|
|
||
| * - authSource=String | ||
| - ``:auth_source => String`` | ||
| * - tlsAllowInvalidCertificates=Boolean | ||
| - ``:ssl_verify => boolean`` | ||
|
|
||
| * - authMechanism=String | ||
| - ``:auth_mech => Symbol`` | ||
| Because ``tlsAllowInvalidCertificates`` uses ``true`` to signify that verification | ||
| should be disabled and ``ssl_verify`` uses ``false`` to signify that verification should be | ||
| disabled, the boolean is inverted before being used to set ``ssl_verify`` | ||
|
|
||
| * - authMechanismProperties=Strings | ||
| - ``{ :auth_mech_properties => { :service_realm => String, :canonicalize_host_name => true|false, :service_name => String } }`` | ||
| * - tlsCAFile=String | ||
| - ``:ssl_ca_cert => String`` | ||
|
|
||
| * - appName=String | ||
| - ``:app_name => String`` | ||
| * - tlsClientCertFile=String | ||
| - ``:ssl_cert => String`` | ||
|
|
||
| * - compressors=Strings | ||
| - ``:compressors => Array<String>`` | ||
| * - tlsClientKeyFile=String | ||
| - ``:ssl_key => String`` | ||
|
|
||
| * - tlsClientKeyPassword=String | ||
| - ``:ssl_key_pass_phrase => String`` | ||
|
|
||
| * - tlsInsecure=Boolean | ||
| - ``:ssl_verify => boolean`` | ||
|
|
||
| Because tlsInsecure uses ``true`` to signify that verification should be disabled and | ||
| ``ssl_verify`` uses ``false`` to signify that verification should be disabled, the boolean | ||
| is inverted before being used to set ``ssl_verify`` | ||
|
|
||
| * - w=Integer|String | ||
| - ``{ :write => { :w => Integer|String }}`` | ||
|
|
||
| * - waitQueueTimeoutMS=Integer | ||
| - ``:wait_queue_timeout => Float`` | ||
|
|
||
| * - wtimeoutMS=Integer | ||
| - ``{ :write => { :wtimeout => Float }}`` | ||
|
|
||
| * - zlibCompressionLevel=Integer | ||
| - ``:zlib_compression_level => Integer`` | ||
|
|
@@ -178,12 +218,12 @@ Ruby Options | |
|
|
||
| * - ``:replica_set`` | ||
| - When connecting to a replica set, this is the name of the set to | ||
| filter servers by. | ||
| filter servers by. | ||
| - ``String`` | ||
| - none | ||
|
|
||
| * - ``:ssl`` | ||
| - Tell the client to connect to the servers via SSL. | ||
| - Tell the client to connect to the servers via SSL. | ||
| - ``Boolean`` | ||
| - false | ||
|
|
||
|
|
@@ -255,30 +295,30 @@ Ruby Options | |
|
|
||
| * - ``:connect_timeout`` | ||
| - The number of seconds to wait to establish a socket connection | ||
| before raising an exception. | ||
| before raising an exception. | ||
| - ``Float`` | ||
| - 10 seconds | ||
|
|
||
| * - ``:socket_timeout`` | ||
| - The number of seconds to wait for an operation to execute on a | ||
| socket before raising an exception. | ||
| socket before raising an exception. | ||
| - ``Float`` | ||
| - 5 seconds | ||
|
|
||
| * - ``:max_pool_size`` | ||
| - The maximum size of the connection pool for each server. | ||
| - The maximum size of the connection pool for each server. | ||
| - ``Integer`` | ||
| - 5 | ||
|
|
||
| * - ``:min_pool_size`` | ||
| - The minimum number of connections in the connection pool for each | ||
| server. | ||
| server. | ||
| - ``Integer`` | ||
| - 1 | ||
|
|
||
| * - ``:wait_queue_timeout`` | ||
| - The number of seconds to wait for a connection in the connection | ||
| pool to become available. | ||
| pool to become available. | ||
| - ``Float`` | ||
| - 1 | ||
|
|
||
|
|
@@ -291,22 +331,22 @@ Ruby Options | |
| { :write => { :w => 2 } } | ||
| - ``Hash`` | ||
| - ``{ :w => 1 }`` | ||
|
|
||
| * - ``:read`` | ||
| - Specifies the read preference mode and tag sets for selecting servers as a ``Hash``. | ||
| Keys in the hash are ``:mode`` and ``:tag_sets``. | ||
|
|
||
| .. code-block:: ruby | ||
|
|
||
| { :read => | ||
| { :mode => :secondary, | ||
| :tag_sets => [ "berlin" ] | ||
| } | ||
| { :read => | ||
| { :mode => :secondary, | ||
| :tag_sets => [ "berlin" ] | ||
| } | ||
| } | ||
|
|
||
| - ``Hash`` | ||
| - ``{ :mode => :primary }`` | ||
|
|
||
| * - ``:auth_source`` | ||
| - Specifies the authentication source. | ||
| - ``String`` | ||
|
|
@@ -316,7 +356,7 @@ Ruby Options | |
|
|
||
| * - ``:auth_mech`` | ||
| - Specifies the authenticaion mechanism to use. Can be one of: | ||
| ``:mongodb_cr``, ``:mongodb_x509``, ``:plain``, ``:scram``. | ||
| ``:mongodb_cr``, ``:mongodb_x509``, ``:plain``, ``:scram``. | ||
| - ``Symbol`` | ||
| - MongoDB 3.0 and later: ``:scram`` if user credentials | ||
| are supplied but an ``:auth_mech`` is not. 2.6 and earlier: | ||
|
|
@@ -343,7 +383,7 @@ Ruby Options | |
| ``:replica_set`` or ``:sharded``. | ||
| - ``Symbol`` | ||
| - none | ||
|
|
||
| * - ``:heartbeat_frequency`` | ||
| - The number of seconds for the server monitors to refresh | ||
| server states asynchronously. | ||
|
|
@@ -437,9 +477,9 @@ Details on Timeout Options | |
|
|
||
| ``connect_timeout`` | ||
| On initialization of a connection to a server, this setting is the | ||
| number of seconds to wait to connect before raising an exception. | ||
| number of seconds to wait to connect before raising an exception. | ||
| This timeout is also used when monitor threads ping their servers. | ||
| The default is 10 seconds. See the `socket timeout for monitoring | ||
| The default is 10 seconds. See the `socket timeout for monitoring | ||
| specification <https://github.com/mongodb/specifications/blob/ | ||
| master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#socket-timeout-for-monitoring | ||
| -is-connecttimeoutms>`_ for further explanation. | ||
|
|
@@ -457,7 +497,7 @@ Details on Timeout Options | |
| The number of seconds to wait for the driver to find an appropriate server to | ||
| which an operation can be sent before raising an exception. Defaults to 30. | ||
| It should take the speed of :manual:`elections</core/replica-set-elections/>` | ||
| during a failover into account. See the | ||
| during a failover into account. See the | ||
| `serverSelectionTimeoutMS specification | ||
| <https://github.com/mongodb/specifications/blob/master/source/server-selection/server-selection.rst#serverselectiontimeoutms>`_ | ||
| for further information. | ||
|
|
@@ -466,10 +506,10 @@ Details on Timeout Options | |
| The maximum latency in seconds between the nearest server and the servers that can be considered available to send an | ||
| operation to. Defaults to 0.015. | ||
|
|
||
| .. note:: | ||
| .. note:: | ||
| This is not the latency window between the driver and a server, but | ||
| rather the latency between the nearest server and other servers. See | ||
| `the localThresholdMS specification | ||
| `the localThresholdMS specification | ||
| <https://github.com/mongodb/specifications/blob/master/source/server-selection/server-selection.rst#localthresholdms>`_. | ||
|
|
||
| ``wait_queue_timeout`` | ||
|
|
@@ -483,7 +523,7 @@ Details on Timeout Options | |
|
|
||
| ``min_pool_size`` | ||
| Minimum number of connections in the connection pool for each server. | ||
| Increase this number to create connections when the pool is | ||
| Increase this number to create connections when the pool is | ||
| initialized and to reduce the overhead of creating new connections | ||
| later on. Defaults to 1. | ||
|
|
||
|
|
@@ -669,7 +709,7 @@ You can either use the default global driver logger or set your own. To set your | |
| Mongo::Logger.logger = other_logger | ||
|
|
||
| See the `Ruby Logger documentation <http://ruby-doc.org/stdlib-2.2.0/libdoc/logger/rdoc/Logger.html>`_ | ||
| for more information on the default logger API and available levels. | ||
| for more information on the default logger API and available levels. | ||
|
|
||
| Changing the Logger Level | ||
| ````````````````````````` | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would a user determine what to put in
Stringsfor this option?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This already existed in the old code; I just alphabetized the list for easier reading. If you just look at the diff for e396935, you'll see the options that are new.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added extra documentation to this option and the others below where the type being forwarded is different from the type specified in the URI. Let me know if you think any of the other options need extra documentation as well.