From c2e7404ea9cdc2e0d5ee836a463b878c1daf8357 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 4 Jul 2024 17:37:59 +0200 Subject: [PATCH 1/8] RUBY-3378 Document CSOT --- docs/reference/create-client.txt | 40 +++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/docs/reference/create-client.txt b/docs/reference/create-client.txt index 346aab93fd..37deb475bf 100644 --- a/docs/reference/create-client.txt +++ b/docs/reference/create-client.txt @@ -729,7 +729,8 @@ Ruby Options - 30 * - ``:socket_timeout`` - - The number of seconds to wait for an operation to execute on a + - **Deprecated. Use :timeout_ms instead.** + The number of seconds to wait for an operation to execute on a socket before raising an exception. ``nil`` and ``0`` mean no timeout. Client creation will fail with an error if an invalid timeout value is passed (such as a negative value or a non-numeric value). @@ -878,6 +879,14 @@ Ruby Options - ``Boolean`` - true + * - ``:timeout_ms`` + - Per-operation timeout value in milliseconds. This option specifies + the best-effort maximum amount of time a single operation can take + before control is returned to the application. An explicit value of 0 + means infinite. + - ``Integer`` + - none + * - ``:truncate_logs`` - Whether to truncate the logs at the default 250 characters. - ``Boolean`` @@ -889,7 +898,8 @@ Ruby Options - none * - ``:wait_queue_timeout`` - - The number of seconds to wait for a connection in the connection + - **Deprecated. Use :timeout_ms instead.** + The number of seconds to wait for a connection in the connection pool to become available. - ``Float`` - 10 @@ -912,6 +922,7 @@ Ruby Options - Specifies write concern options as a ``Hash``. Keys in the hash can be ``:w``, ``:wtimeout``, ``:j``, ``:fsync``. Note that ``:wtimeout`` is specified in milliseconds, not seconds. + ``:wtimeout`` is deprecates, use ``timeout_ms`` instead. .. code-block:: ruby @@ -1085,6 +1096,9 @@ URI options are explained in detail in the :manual:`Connection URI reference * - ssl=Boolean - ``:ssl => true|false`` + * - timeoutMS=Integer + - ``:timeout_ms => Integer `` + * - tls=Boolean - ``:ssl => boolean`` @@ -1185,6 +1199,7 @@ provide quicker failure when the server is not running. ``socket_timeout`` ------------------ +**Deprecated. Use timeout_ms instead.** The number of seconds to wait for a socket read or write to complete on regular (non-monitoring) connections. Default is no timeout. @@ -1226,8 +1241,9 @@ DNS lookups. Note that the timeout applies per lookup; due to DNS suffix search lists, multiple lookups may be performed as part of a single name resolution. ``wait_queue_timeout`` -`````````````````````` +---------------------- +**Deprecated. Use timeout_ms instead.** The number of seconds to wait for a connection in the connection pool to become available. Defaults to 10. @@ -1239,6 +1255,8 @@ round trips. ``max_time_ms`` --------------- +**Deprecated. Use timeout_ms instead.** +The number of seconds to wait for a connection in the connection pool to Specified as an option on a particular operation, the number of milliseconds to allow the operation to execute for on the server. Not set by default. @@ -1246,9 +1264,25 @@ Consider using this option instead of a ``socket_timeout`` for potentially long running operations to be interrupted on the server when they take too long. +``timeout_ms`` +-------------- + +The per-operation timeout value in milliseconds. The option specifies the +best-effort maximum amount of time a single operation can take before control +is returned to the application. This option is configurable at the level of +a ``Mongo::Client``, database, collection, or of a single operation. Not set by +default. An explicit value of 0 means infinite. + +If this option is set and the timeout expires, the driver aborts all blocking +work and return control to the user with an error ``Mongo::Error::TimeoutError``. + +If this option is set, the driver ignore any deprecated timeout option - +``socket_timeout``, ``wait_queue_timeout``, ``wtimeout``, ``max_time_ms``. + ``wtimeout`` ------------ +**Deprecated. Use timeout_ms instead.** The number of milliseconds to wait for a write to be acknowledged by the number of servers specified in the write concern. Not set by default, which instructs the server to apply its default. This option can be set globally From 3eeabb7f8c8fd4f9ec207eab15809885fc1ebae4 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 4 Jul 2024 18:03:12 +0200 Subject: [PATCH 2/8] Client and database --- lib/mongo/client.rb | 9 ++++++--- lib/mongo/database.rb | 22 ++++++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/mongo/client.rb b/lib/mongo/client.rb index 6f6e1b06f2..060551818b 100644 --- a/lib/mongo/client.rb +++ b/lib/mongo/client.rb @@ -350,7 +350,8 @@ def hash # @option options [ Integer ] :server_selection_timeout The timeout in seconds # for selecting a server for an operation. # @option options [ Float ] :socket_timeout The timeout, in seconds, to - # execute operations on a socket. + # execute operations on a socket. This option is deprecated, use + # :timeout_ms instead. # @option options [ Integer ] :srv_max_hosts The maximum number of mongoses # that the driver will communicate with for sharded topologies. If this # option is 0, then there will be no maximum number of mongoses. If the @@ -415,12 +416,14 @@ def hash # validation. This setting overrides :ssl_verify with respect to whether hostname validation # is performed. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # @option options [ true, false ] :truncate_logs Whether to truncate the # logs at the default 250 characters. # @option options [ String ] :user The user name. # @option options [ Float ] :wait_queue_timeout The time to wait, in # seconds, in the connection pool for a connection to be checked in. + # This option is deprecated, use :timeout_ms instead. # @option options [ Array ] :wrapping_libraries Information about # libraries such as ODMs that are wrapping the driver, to be added to # metadata sent to the server. Specify the lower level libraries first. @@ -428,7 +431,7 @@ def hash # @option options [ Hash ] :write Deprecated. Equivalent to :write_concern # option. # @option options [ Hash ] :write_concern The write concern options. - # Can be :w => Integer|String, :wtimeout => Integer (in milliseconds), + # Can be :w => Integer|String, :wtimeout => Integer (in milliseconds, deprecated), # :j => Boolean, :fsync => Boolean. # @option options [ Integer ] :zlib_compression_level The Zlib compression level to use, if using compression. # See Ruby's Zlib module for valid levels. diff --git a/lib/mongo/database.rb b/lib/mongo/database.rb index ab23311895..ab28ea77ba 100644 --- a/lib/mongo/database.rb +++ b/lib/mongo/database.rb @@ -129,7 +129,8 @@ def [](collection_name, options = {}) # @option options [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # # See https://mongodb.com/docs/manual/reference/command/listCollections/ # for more information and usage. @@ -159,7 +160,8 @@ def collection_names(options = {}) # @option options [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # # See https://mongodb.com/docs/manual/reference/command/listCollections/ # for more information and usage. @@ -186,7 +188,8 @@ def list_collections(options = {}) # @option options [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # # See https://mongodb.com/docs/manual/reference/command/listCollections/ # for more information and usage. @@ -209,7 +212,8 @@ def collections(options = {}) # @option opts :read [ Hash ] The read preference for this command. # @option opts :session [ Session ] The session to use for this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # @option opts :execution_options [ Hash ] Options to pass to the code that # executes this command. This is an internal option and is subject to # change. @@ -259,8 +263,9 @@ def command(operation, opts = {}) # @option opts :session [ Session ] The session to use for this command. # @option opts [ Object ] :comment A user-provided # comment to attach to this command. - # @option opts [ Integer | nil ] :timeout_ms Operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # # @return [ Hash ] The result of the command execution. # @api private @@ -301,8 +306,9 @@ def read_command(operation, opts = {}) # # @option options [ Session ] :session The session to use for the operation. # @option options [ Hash ] :write_concern The write concern options. - # @option options [ Integer | nil ] :timeout_ms Operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # # @return [ Result ] The result of the command. # From 89f30c67933a4452453b465867f055e6e4f9cad1 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 5 Jul 2024 11:09:22 +0200 Subject: [PATCH 3/8] Collection --- lib/mongo/client.rb | 10 ++- lib/mongo/collection.rb | 127 ++++++++++++++++++++----------- lib/mongo/crypt/encryption_io.rb | 20 +++-- lib/mongo/database.rb | 22 ++++-- 4 files changed, 121 insertions(+), 58 deletions(-) diff --git a/lib/mongo/client.rb b/lib/mongo/client.rb index 060551818b..45bb6a9859 100644 --- a/lib/mongo/client.rb +++ b/lib/mongo/client.rb @@ -942,8 +942,9 @@ def reconnect # @option opts [ Session ] :session The session to use. # @option opts [ Object ] :comment A user-provided # comment to attach to this command. - # @option opts [ Integer | nil ] :timeout_ms Operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # # @return [ Array ] The names of the databases. # @@ -966,8 +967,9 @@ def database_names(filter = {}, opts = {}) # is enabled. # @option opts [ Object ] :comment A user-provided # comment to attach to this command. - # @option opts [ Integer | nil ] :timeout_ms Operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # # See https://mongodb.com/docs/manual/reference/command/listDatabases/ # for more information and usage. diff --git a/lib/mongo/collection.rb b/lib/mongo/collection.rb index 5cd379b982..76b5a83abf 100644 --- a/lib/mongo/collection.rb +++ b/lib/mongo/collection.rb @@ -136,8 +136,10 @@ def ==(other) # - *:local_threshold*. # @option options [ Session ] :session The session to use for the operation. # @option options [ Integer ] :size The size of the capped collection. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the database or the client. # @option opts [ Hash ] :time_series Create a time-series collection. # The hash may have the following items: # - *:timeField* -- The name of the field which contains the date in each @@ -441,8 +443,10 @@ def create(opts = {}) # @option opts [ Hash ] :write_concern The write concern options. # @option opts [ Hash | nil ] :encrypted_fields Encrypted fields hash that # was provided to `create` collection helper. - # @option opts [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @return [ Result ] The result of the command. # @@ -514,8 +518,10 @@ def drop(opts = {}) # @option options [ :cursor_lifetime | :iteration ] :timeout_mode How to interpret # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option options [ Hash ] :let Mapping of variables to use in the command. # See the server documentation for details. # @@ -549,8 +555,10 @@ def find(filter = nil, options = {}) # @option options [ Integer ] :max_time_ms The maximum amount of time in # milliseconds to allow the aggregation to run. # @option options [ Session ] :session The session to use. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @return [ View::Aggregation ] The aggregation object. # @@ -621,8 +629,10 @@ def aggregate(pipeline, options = {}) # @option options [ :cursor_lifetime | :iteration ] :timeout_mode How to interpret # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). - # @option options [ Integer ] :timeout_ms The maximum amount of time to - # allow the query to run, in milliseconds. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @note A change stream only allows 'majority' read concern. # @note This helper method is preferable to running a raw aggregation with @@ -654,8 +664,10 @@ def watch(pipeline = [], options = {}) # @option options [ Session ] :session The session to use. # @option options [ Object ] :comment A user-provided # comment to attach to this command. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @return [ Integer ] The document count. # @@ -692,8 +704,10 @@ def count(filter = nil, options = {}) # @option options [ Session ] :session The session to use. # @option options [ Object ] :comment A user-provided # comment to attach to this command. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @return [ Integer ] The document count. # @@ -715,8 +729,10 @@ def count_documents(filter = {}, options = {}) # @option options [ Hash ] :read The read preference options. # @option options [ Object ] :comment A user-provided # comment to attach to this command. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @return [ Integer ] The document count. # @@ -738,8 +754,10 @@ def estimated_document_count(options = {}) # @option options [ Hash ] :read The read preference options. # @option options [ Hash ] :collation The collation to use. # @option options [ Session ] :session The session to use. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @return [ Array ] The list of distinct values. # @@ -812,8 +830,10 @@ def inspect # @option opts [ Object ] :comment A user-provided comment to attach to # this command. # @option opts [ Session ] :session The session to use for the operation. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option opts [ Hash ] :write_concern The write concern options. # Can be :w => Integer, :fsync => Boolean, :j => Boolean. # @@ -871,9 +891,10 @@ def insert_one(document, opts = {}) # @option options [ true | false ] :ordered Whether the operations # should be executed in order. # @option options [ Session ] :session The session to use for the operation. - # @option options [ Integer ] :timeout_ms The timeout in milliseconds for the - # complete operation. Must a positive integer. The default value is unset - # which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option options [ Hash ] :write_concern The write concern options. # Can be :w => Integer, :fsync => Boolean, :j => Boolean. # @@ -902,8 +923,10 @@ def insert_many(documents, options = {}) # @option options [ true | false ] :bypass_document_validation Whether or # not to skip document level validation. # @option options [ Session ] :session The session to use for the set of operations. - # @option options [ Integer ] :timeout_ms The timeout in milliseconds for all the operations. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option options [ Hash ] :let Mapping of variables to use in the command. # See the server documentation for details. # @@ -926,8 +949,10 @@ def bulk_write(requests, options = {}) # @option options [ Session ] :session The session to use. # @option options [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option options [ Hash ] :let Mapping of variables to use in the command. # See the server documentation for details. # @@ -950,8 +975,10 @@ def delete_one(filter = nil, options = {}) # @option options [ Session ] :session The session to use. # @option options [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option options [ Hash ] :let Mapping of variables to use in the command. # See the server documentation for details. # @@ -980,8 +1007,10 @@ def delete_many(filter = nil, options = {}) # @option options [ :cursor_lifetime | :iteration ] :timeout_mode How to interpret # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). - # @option options [ Integer ] :timeout_ms The maximum amount of time to - # allow the query to run, in milliseconds. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @return [ Array ] An array of cursors. # @@ -1005,8 +1034,10 @@ def parallel_scan(cursor_count, options = {}) # not to skip document level validation. # @option options [ Hash ] :collation The collation to use. # @option options [ Session ] :session The session to use. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option options [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). # @option options [ Hash ] :let Mapping of variables to use in the command. @@ -1036,8 +1067,10 @@ def replace_one(filter, replacement, options = {}) # @option options [ Array ] :array_filters A set of filters specifying to which array elements # an update should apply. # @option options [ Session ] :session The session to use. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option options [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). # @option options [ Hash ] :let Mapping of variables to use in the command. @@ -1067,8 +1100,10 @@ def update_many(filter, update, options = {}) # @option options [ Array ] :array_filters A set of filters specifying to which array elements # an update should apply. # @option options [ Session ] :session The session to use. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option options [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). # @option options [ Hash ] :let Mapping of variables to use in the command. @@ -1099,8 +1134,10 @@ def update_one(filter, update, options = {}) # Defaults to the collection's write concern. # @option options [ Hash ] :collation The collation to use. # @option options [ Session ] :session The session to use. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option options [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). # @option options [ Hash ] :let Mapping of variables to use in the command. @@ -1145,8 +1182,10 @@ def find_one_and_delete(filter, options = {}) # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). # @option options [ Hash ] :let Mapping of variables to use in the command. # See the server documentation for details. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @return [ BSON::Document ] The document. # @@ -1183,8 +1222,10 @@ def find_one_and_update(filter, update, options = {}) # @option options [ Session ] :session The session to use. # @option options [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option options [ Hash ] :let Mapping of variables to use in the command. # See the server documentation for details. # diff --git a/lib/mongo/crypt/encryption_io.rb b/lib/mongo/crypt/encryption_io.rb index 3f6f7747c3..8b90dbba19 100644 --- a/lib/mongo/crypt/encryption_io.rb +++ b/lib/mongo/crypt/encryption_io.rb @@ -73,7 +73,9 @@ def initialize( # filter # # @param [ Hash ] filter - # @param [ Integer | nil ] :timeout_ms + # @param [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # # @return [ Array ] The query results def find_keys(filter, timeout_ms: nil) @@ -83,7 +85,9 @@ def find_keys(filter, timeout_ms: nil) # Insert a document into the key vault collection # # @param [ Hash ] document - # @param [ Integer | nil ] :timeout_ms + # @param [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # # @return [ Mongo::Operation::Insert::Result ] The insertion result def insert_data_key(document, timeout_ms: nil) @@ -93,7 +97,9 @@ def insert_data_key(document, timeout_ms: nil) # Get collection info for a collection matching the provided filter # # @param [ Hash ] filter - # @param [ Integer | nil ] :timeout_ms + # @param [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # # @return [ Hash ] The collection information def collection_info(db_name, filter, timeout_ms: nil) @@ -111,7 +117,9 @@ def collection_info(db_name, filter, timeout_ms: nil) # Send the command to mongocryptd to be marked with intent-to-encrypt markings # # @param [ Hash ] cmd - # @param [ Integer | nil ] :timeout_ms + # @param [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. # # @return [ Hash ] The marked command def mark_command(cmd, timeout_ms: nil) @@ -147,7 +155,9 @@ def mark_command(cmd, timeout_ms: nil) # to send on that connection. # @param [ Hash ] tls_options. TLS options to connect to KMS provider. # The options are same as for Mongo::Client. - # @param [ Integer | nil ] :timeout_ms + # @param [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is not enabled. def feed_kms(kms_context, tls_options, timeout_ms: nil) with_ssl_socket(kms_context.endpoint, tls_options) do |ssl_socket| Timeout.timeout(timeout_ms || SOCKET_TIMEOUT, Error::SocketTimeoutError, diff --git a/lib/mongo/database.rb b/lib/mongo/database.rb index ab28ea77ba..86f5d22dc7 100644 --- a/lib/mongo/database.rb +++ b/lib/mongo/database.rb @@ -130,7 +130,8 @@ def [](collection_name, options = {}) # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. # Must a non-negative integer. An explicit value of 0 means infinite. - # The default value is unset which means the feature is not enabled. + # The default value is unset which means the value is inherited from + # the database or the client. # # See https://mongodb.com/docs/manual/reference/command/listCollections/ # for more information and usage. @@ -161,7 +162,8 @@ def collection_names(options = {}) # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. # Must a non-negative integer. An explicit value of 0 means infinite. - # The default value is unset which means the feature is not enabled. + # The default value is unset which means the value is inherited from + # the database or the client. # # See https://mongodb.com/docs/manual/reference/command/listCollections/ # for more information and usage. @@ -189,7 +191,8 @@ def list_collections(options = {}) # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. # Must a non-negative integer. An explicit value of 0 means infinite. - # The default value is unset which means the feature is not enabled. + # The default value is unset which means the value is inherited from + # the database or the client. # # See https://mongodb.com/docs/manual/reference/command/listCollections/ # for more information and usage. @@ -213,7 +216,8 @@ def collections(options = {}) # @option opts :session [ Session ] The session to use for this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. # Must a non-negative integer. An explicit value of 0 means infinite. - # The default value is unset which means the feature is not enabled. + # The default value is unset which means the value is inherited from + # the database or the client. # @option opts :execution_options [ Hash ] Options to pass to the code that # executes this command. This is an internal option and is subject to # change. @@ -265,7 +269,8 @@ def command(operation, opts = {}) # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. # Must a non-negative integer. An explicit value of 0 means infinite. - # The default value is unset which means the feature is not enabled. + # The default value is unset which means the value is inherited from + # the database or the client. # # @return [ Hash ] The result of the command execution. # @api private @@ -308,7 +313,8 @@ def read_command(operation, opts = {}) # @option options [ Hash ] :write_concern The write concern options. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. # Must a non-negative integer. An explicit value of 0 means infinite. - # The default value is unset which means the feature is not enabled. + # The default value is unset which means the value is inherited from + # the database or the client. # # @return [ Result ] The result of the command. # @@ -345,6 +351,10 @@ def drop(options = {}) # @param [ Mongo::Client ] client The driver client. # @param [ String, Symbol ] name The name of the database. # @param [ Hash ] options The options. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the client. # # @raise [ Mongo::Database::InvalidName ] If the name is nil. # From 9a18b6d483b9391b276d38faf4b66cb6426ebb17 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 5 Jul 2024 14:24:45 +0200 Subject: [PATCH 4/8] More comments --- lib/mongo/client_encryption.rb | 5 ++- lib/mongo/collection/view.rb | 6 ++- lib/mongo/collection/view/aggregation.rb | 6 ++- lib/mongo/collection/view/readable.rb | 24 ++++++++---- lib/mongo/collection/view/writable.rb | 48 ++++++++++++++++-------- lib/mongo/database/view.rb | 10 +++-- lib/mongo/index/view.rb | 6 ++- lib/mongo/session.rb | 14 +++++-- 8 files changed, 80 insertions(+), 39 deletions(-) diff --git a/lib/mongo/client_encryption.rb b/lib/mongo/client_encryption.rb index b585a8925f..1ebddcbca3 100644 --- a/lib/mongo/client_encryption.rb +++ b/lib/mongo/client_encryption.rb @@ -40,8 +40,9 @@ class ClientEncryption # should be hashes of TLS connection options. The options are equivalent # to TLS connection options of Mongo::Client. # @see Mongo::Client#initialize for list of TLS options. - # @option options [ Integer ] :timeout_ms Timeout that will be applied to all - # operations on this instance. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the feature is disabled. # # @raise [ ArgumentError ] If required options are missing or incorrectly # formatted. diff --git a/lib/mongo/collection/view.rb b/lib/mongo/collection/view.rb index 476fe65992..a473d508c0 100644 --- a/lib/mongo/collection/view.rb +++ b/lib/mongo/collection/view.rb @@ -160,8 +160,10 @@ def hash # @option options [ :cursor_lifetime | :iteration ] :timeout_mode How to interpret # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @since 2.0.0 def initialize(collection, filter = {}, options = {}) diff --git a/lib/mongo/collection/view/aggregation.rb b/lib/mongo/collection/view/aggregation.rb index ccbd5e09e0..a93a7aaa59 100644 --- a/lib/mongo/collection/view/aggregation.rb +++ b/lib/mongo/collection/view/aggregation.rb @@ -58,8 +58,10 @@ class Aggregation # @option options [ :cursor_lifetime | :iteration ] :timeout_mode How to interpret # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @since 2.0.0 def initialize(view, pipeline, options = {}) diff --git a/lib/mongo/collection/view/readable.rb b/lib/mongo/collection/view/readable.rb index d548031ac4..e45ac956e1 100644 --- a/lib/mongo/collection/view/readable.rb +++ b/lib/mongo/collection/view/readable.rb @@ -49,8 +49,10 @@ module Readable # @option options [ Integer ] :max_time_ms The maximum amount of time in # milliseconds to allow the aggregation to run. # @option options [ Session ] :session The session to use. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @return [ Aggregation ] The aggregation object. # @@ -155,8 +157,10 @@ def comment(comment = nil) # @option opts [ Mongo::Session ] :session The session to use for the operation. # @option opts [ Object ] :comment A user-provided # comment to attach to this command. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @return [ Integer ] The document count. # @@ -224,8 +228,10 @@ def count(opts = {}) # @option opts [ Mongo::Session ] :session The session to use for the operation. # @option ops [ Object ] :comment A user-provided # comment to attach to this command. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @return [ Integer ] The document count. # @@ -257,8 +263,10 @@ def count_documents(opts = {}) # @option opts [ Hash ] :read The read preference options. # @option opts [ Object ] :comment A user-provided # comment to attach to this command. - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @return [ Integer ] The document count. # diff --git a/lib/mongo/collection/view/writable.rb b/lib/mongo/collection/view/writable.rb index ea947b298a..d80f2058bf 100644 --- a/lib/mongo/collection/view/writable.rb +++ b/lib/mongo/collection/view/writable.rb @@ -46,8 +46,10 @@ module Writable # @option opts [ Session ] :session The session to use. # @option opts [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). - # @option opts [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option opts [ Hash ] :write_concern The write concern options. # Can be :w => Integer, :fsync => Boolean, :j => Boolean. # @option opts [ Hash ] :let Mapping of variables to use in the command. @@ -122,8 +124,10 @@ def find_one_and_delete(opts = {}) # @option opts [ Hash ] :collation The collation to use. # @option opts [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). - # @option opts [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option opts [ Hash ] :write_concern The write concern options. # Can be :w => Integer, :fsync => Boolean, :j => Boolean. # @option opts [ Hash ] :let Mapping of variables to use in the command. @@ -157,8 +161,10 @@ def find_one_and_replace(replacement, opts = {}) # @option opts [ Array ] :array_filters A set of filters specifying to which array elements # an update should apply. # @option opts [ Session ] :session The session to use. - # @option opts [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option opts [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). # @option opts [ Hash ] :write_concern The write concern options. @@ -230,8 +236,10 @@ def find_one_and_update(document, opts = {}) # # @option opts [ Hash ] :collation The collation to use. # @option opts [ Session ] :session The session to use. - # @option opts [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option opts [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). # @option opts [ Hash ] :write_concern The write concern options. @@ -300,8 +308,10 @@ def delete_many(opts = {}) # @option opts [ Hash ] :let Mapping of variables to use in the command. # See the server documentation for details. # @option opts [ Session ] :session The session to use. - # @option opts [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option opts [ Hash ] :write_concern The write concern options. # Can be :w => Integer, :fsync => Boolean, :j => Boolean. # @@ -369,8 +379,10 @@ def delete_one(opts = {}) # @option opts [ Hash ] :let Mapping of variables to use in the command. # See the server documentation for details. # @option opts [ Session ] :session The session to use. - # @option opts [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option opts [ Hash ] :write_concern The write concern options. # @option opts [ true, false ] :upsert Whether to upsert if the # document doesn't exist. @@ -447,8 +459,10 @@ def replace_one(replacement, opts = {}) # @option opts [ Hash ] :let Mapping of variables to use in the command. # See the server documentation for details. # @option opts [ Session ] :session The session to use. - # @option opts [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option opts [ true, false ] :upsert Whether to upsert if the # document doesn't exist. # @option opts [ Hash ] :write_concern The write concern options. @@ -525,8 +539,10 @@ def update_many(spec, opts = {}) # @option opts [ Hash ] :let Mapping of variables to use in the command. # See the server documentation for details. # @option opts [ Session ] :session The session to use. - # @option opts [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # @option opts [ true, false ] :upsert Whether to upsert if the # document doesn't exist. # @option opts [ Hash ] :write_concern The write concern options. diff --git a/lib/mongo/database/view.rb b/lib/mongo/database/view.rb index 99c46066f8..02d41d5301 100644 --- a/lib/mongo/database/view.rb +++ b/lib/mongo/database/view.rb @@ -61,7 +61,9 @@ class View # @option options [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the database or the client. # # See https://mongodb.com/docs/manual/reference/command/listCollections/ # for more information and usage. @@ -138,8 +140,10 @@ def list_collections(options = {}) # @option options [ :cursor_lifetime | :iteration ] :timeout_mode How to interpret # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the database or the client. # # @since 2.0.0 def initialize(database, options = {}) diff --git a/lib/mongo/index/view.rb b/lib/mongo/index/view.rb index be9e1e7f88..c985da3896 100644 --- a/lib/mongo/index/view.rb +++ b/lib/mongo/index/view.rb @@ -309,8 +309,10 @@ def each(&block) # @option options [ :cursor_lifetime | :iteration ] :timeout_mode How to interpret # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). - # @option options [ Integer ] :timeout_ms The per-operation timeout in milliseconds. - # Must a positive integer. The default value is unset which means infinite. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the collection or the database or the client. # # @since 2.0.0 def initialize(collection, options = {}) diff --git a/lib/mongo/session.rb b/lib/mongo/session.rb index 5fbd3801fa..1501d12609 100644 --- a/lib/mongo/session.rb +++ b/lib/mongo/session.rb @@ -570,8 +570,10 @@ def with_transaction(options = nil) # items: # - *:mode* -- read preference specified as a symbol; the only valid value is # *:primary*. - # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds - # that is applied to the whole transaction. Must a positive integer. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the client. # # @raise [ Error::InvalidTransactionOperation ] If a transaction is already in # progress or if the write concern is unacknowledged. @@ -635,7 +637,9 @@ def start_transaction(options = nil) # @option options :write_concern [ nil | WriteConcern::Base ] The write # concern to use for this operation. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a positive integer. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the client. # # @raise [ Error::InvalidTransactionOperation ] If there is no active transaction. # @@ -715,7 +719,9 @@ def commit_transaction(options=nil) # session.abort_transaction # # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a positive integer. + # Must a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the client. # # @raise [ Error::InvalidTransactionOperation ] If there is no active transaction. # From d1bf06eea6419e2fccf478cd043ed7d88b3b75cc Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 5 Jul 2024 15:03:30 +0200 Subject: [PATCH 5/8] Fix typo --- lib/mongo/client.rb | 6 ++-- lib/mongo/client_encryption.rb | 2 +- lib/mongo/collection.rb | 42 ++++++++++++------------ lib/mongo/collection/view.rb | 2 +- lib/mongo/collection/view/aggregation.rb | 2 +- lib/mongo/collection/view/readable.rb | 8 ++--- lib/mongo/collection/view/writable.rb | 16 ++++----- lib/mongo/crypt/encryption_io.rb | 10 +++--- lib/mongo/database.rb | 14 ++++---- lib/mongo/database/view.rb | 4 +-- lib/mongo/index/view.rb | 2 +- lib/mongo/session.rb | 6 ++-- 12 files changed, 57 insertions(+), 57 deletions(-) diff --git a/lib/mongo/client.rb b/lib/mongo/client.rb index 45bb6a9859..a5d3e030b4 100644 --- a/lib/mongo/client.rb +++ b/lib/mongo/client.rb @@ -416,7 +416,7 @@ def hash # validation. This setting overrides :ssl_verify with respect to whether hostname validation # is performed. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the feature is not enabled. # @option options [ true, false ] :truncate_logs Whether to truncate the # logs at the default 250 characters. @@ -943,7 +943,7 @@ def reconnect # @option opts [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the feature is not enabled. # # @return [ Array ] The names of the databases. @@ -968,7 +968,7 @@ def database_names(filter = {}, opts = {}) # @option opts [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the feature is not enabled. # # See https://mongodb.com/docs/manual/reference/command/listDatabases/ diff --git a/lib/mongo/client_encryption.rb b/lib/mongo/client_encryption.rb index 1ebddcbca3..ce2eeef95c 100644 --- a/lib/mongo/client_encryption.rb +++ b/lib/mongo/client_encryption.rb @@ -41,7 +41,7 @@ class ClientEncryption # to TLS connection options of Mongo::Client. # @see Mongo::Client#initialize for list of TLS options. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the feature is disabled. # # @raise [ ArgumentError ] If required options are missing or incorrectly diff --git a/lib/mongo/collection.rb b/lib/mongo/collection.rb index 76b5a83abf..f904c041d7 100644 --- a/lib/mongo/collection.rb +++ b/lib/mongo/collection.rb @@ -137,7 +137,7 @@ def ==(other) # @option options [ Session ] :session The session to use for the operation. # @option options [ Integer ] :size The size of the capped collection. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the database or the client. # @option opts [ Hash ] :time_series Create a time-series collection. @@ -444,7 +444,7 @@ def create(opts = {}) # @option opts [ Hash | nil ] :encrypted_fields Encrypted fields hash that # was provided to `create` collection helper. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @@ -519,7 +519,7 @@ def drop(opts = {}) # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option options [ Hash ] :let Mapping of variables to use in the command. @@ -556,7 +556,7 @@ def find(filter = nil, options = {}) # milliseconds to allow the aggregation to run. # @option options [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @@ -630,7 +630,7 @@ def aggregate(pipeline, options = {}) # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @@ -665,7 +665,7 @@ def watch(pipeline = [], options = {}) # @option options [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @@ -705,7 +705,7 @@ def count(filter = nil, options = {}) # @option options [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @@ -730,7 +730,7 @@ def count_documents(filter = {}, options = {}) # @option options [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @@ -755,7 +755,7 @@ def estimated_document_count(options = {}) # @option options [ Hash ] :collation The collation to use. # @option options [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @@ -831,7 +831,7 @@ def inspect # this command. # @option opts [ Session ] :session The session to use for the operation. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option opts [ Hash ] :write_concern The write concern options. @@ -892,7 +892,7 @@ def insert_one(document, opts = {}) # should be executed in order. # @option options [ Session ] :session The session to use for the operation. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option options [ Hash ] :write_concern The write concern options. @@ -924,7 +924,7 @@ def insert_many(documents, options = {}) # not to skip document level validation. # @option options [ Session ] :session The session to use for the set of operations. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option options [ Hash ] :let Mapping of variables to use in the command. @@ -950,7 +950,7 @@ def bulk_write(requests, options = {}) # @option options [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option options [ Hash ] :let Mapping of variables to use in the command. @@ -976,7 +976,7 @@ def delete_one(filter = nil, options = {}) # @option options [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option options [ Hash ] :let Mapping of variables to use in the command. @@ -1008,7 +1008,7 @@ def delete_many(filter = nil, options = {}) # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @@ -1035,7 +1035,7 @@ def parallel_scan(cursor_count, options = {}) # @option options [ Hash ] :collation The collation to use. # @option options [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option options [ Hash | String ] :hint The index to use for this operation. @@ -1068,7 +1068,7 @@ def replace_one(filter, replacement, options = {}) # an update should apply. # @option options [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option options [ Hash | String ] :hint The index to use for this operation. @@ -1101,7 +1101,7 @@ def update_many(filter, update, options = {}) # an update should apply. # @option options [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option options [ Hash | String ] :hint The index to use for this operation. @@ -1135,7 +1135,7 @@ def update_one(filter, update, options = {}) # @option options [ Hash ] :collation The collation to use. # @option options [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option options [ Hash | String ] :hint The index to use for this operation. @@ -1183,7 +1183,7 @@ def find_one_and_delete(filter, options = {}) # @option options [ Hash ] :let Mapping of variables to use in the command. # See the server documentation for details. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @@ -1223,7 +1223,7 @@ def find_one_and_update(filter, update, options = {}) # @option options [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option options [ Hash ] :let Mapping of variables to use in the command. diff --git a/lib/mongo/collection/view.rb b/lib/mongo/collection/view.rb index a473d508c0..fc33d85b75 100644 --- a/lib/mongo/collection/view.rb +++ b/lib/mongo/collection/view.rb @@ -161,7 +161,7 @@ def hash # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # diff --git a/lib/mongo/collection/view/aggregation.rb b/lib/mongo/collection/view/aggregation.rb index a93a7aaa59..ab5fb2e5d1 100644 --- a/lib/mongo/collection/view/aggregation.rb +++ b/lib/mongo/collection/view/aggregation.rb @@ -59,7 +59,7 @@ class Aggregation # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # diff --git a/lib/mongo/collection/view/readable.rb b/lib/mongo/collection/view/readable.rb index e45ac956e1..4a0ce09ce7 100644 --- a/lib/mongo/collection/view/readable.rb +++ b/lib/mongo/collection/view/readable.rb @@ -50,7 +50,7 @@ module Readable # milliseconds to allow the aggregation to run. # @option options [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @@ -158,7 +158,7 @@ def comment(comment = nil) # @option opts [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @@ -229,7 +229,7 @@ def count(opts = {}) # @option ops [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @@ -264,7 +264,7 @@ def count_documents(opts = {}) # @option opts [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # diff --git a/lib/mongo/collection/view/writable.rb b/lib/mongo/collection/view/writable.rb index d80f2058bf..50f8119112 100644 --- a/lib/mongo/collection/view/writable.rb +++ b/lib/mongo/collection/view/writable.rb @@ -47,7 +47,7 @@ module Writable # @option opts [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option opts [ Hash ] :write_concern The write concern options. @@ -125,7 +125,7 @@ def find_one_and_delete(opts = {}) # @option opts [ Hash | String ] :hint The index to use for this operation. # May be specified as a Hash (e.g. { _id: 1 }) or a String (e.g. "_id_"). # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option opts [ Hash ] :write_concern The write concern options. @@ -162,7 +162,7 @@ def find_one_and_replace(replacement, opts = {}) # an update should apply. # @option opts [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option opts [ Hash | String ] :hint The index to use for this operation. @@ -237,7 +237,7 @@ def find_one_and_update(document, opts = {}) # @option opts [ Hash ] :collation The collation to use. # @option opts [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option opts [ Hash | String ] :hint The index to use for this operation. @@ -309,7 +309,7 @@ def delete_many(opts = {}) # See the server documentation for details. # @option opts [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option opts [ Hash ] :write_concern The write concern options. @@ -380,7 +380,7 @@ def delete_one(opts = {}) # See the server documentation for details. # @option opts [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option opts [ Hash ] :write_concern The write concern options. @@ -460,7 +460,7 @@ def replace_one(replacement, opts = {}) # See the server documentation for details. # @option opts [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option opts [ true, false ] :upsert Whether to upsert if the @@ -540,7 +540,7 @@ def update_many(spec, opts = {}) # See the server documentation for details. # @option opts [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # @option opts [ true, false ] :upsert Whether to upsert if the diff --git a/lib/mongo/crypt/encryption_io.rb b/lib/mongo/crypt/encryption_io.rb index 8b90dbba19..6bd5bccf4e 100644 --- a/lib/mongo/crypt/encryption_io.rb +++ b/lib/mongo/crypt/encryption_io.rb @@ -74,7 +74,7 @@ def initialize( # # @param [ Hash ] filter # @param [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the feature is not enabled. # # @return [ Array ] The query results @@ -86,7 +86,7 @@ def find_keys(filter, timeout_ms: nil) # # @param [ Hash ] document # @param [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the feature is not enabled. # # @return [ Mongo::Operation::Insert::Result ] The insertion result @@ -98,7 +98,7 @@ def insert_data_key(document, timeout_ms: nil) # # @param [ Hash ] filter # @param [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the feature is not enabled. # # @return [ Hash ] The collection information @@ -118,7 +118,7 @@ def collection_info(db_name, filter, timeout_ms: nil) # # @param [ Hash ] cmd # @param [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the feature is not enabled. # # @return [ Hash ] The marked command @@ -156,7 +156,7 @@ def mark_command(cmd, timeout_ms: nil) # @param [ Hash ] tls_options. TLS options to connect to KMS provider. # The options are same as for Mongo::Client. # @param [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the feature is not enabled. def feed_kms(kms_context, tls_options, timeout_ms: nil) with_ssl_socket(kms_context.endpoint, tls_options) do |ssl_socket| diff --git a/lib/mongo/database.rb b/lib/mongo/database.rb index 86f5d22dc7..aebd9b65e5 100644 --- a/lib/mongo/database.rb +++ b/lib/mongo/database.rb @@ -129,7 +129,7 @@ def [](collection_name, options = {}) # @option options [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the database or the client. # @@ -161,7 +161,7 @@ def collection_names(options = {}) # @option options [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the database or the client. # @@ -190,7 +190,7 @@ def list_collections(options = {}) # @option options [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the database or the client. # @@ -215,7 +215,7 @@ def collections(options = {}) # @option opts :read [ Hash ] The read preference for this command. # @option opts :session [ Session ] The session to use for this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the database or the client. # @option opts :execution_options [ Hash ] Options to pass to the code that @@ -268,7 +268,7 @@ def command(operation, opts = {}) # @option opts [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the database or the client. # @@ -312,7 +312,7 @@ def read_command(operation, opts = {}) # @option options [ Session ] :session The session to use for the operation. # @option options [ Hash ] :write_concern The write concern options. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the database or the client. # @@ -352,7 +352,7 @@ def drop(options = {}) # @param [ String, Symbol ] name The name of the database. # @param [ Hash ] options The options. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the client. # diff --git a/lib/mongo/database/view.rb b/lib/mongo/database/view.rb index 02d41d5301..883e041d47 100644 --- a/lib/mongo/database/view.rb +++ b/lib/mongo/database/view.rb @@ -61,7 +61,7 @@ class View # @option options [ Object ] :comment A user-provided # comment to attach to this command. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the database or the client. # @@ -141,7 +141,7 @@ def list_collections(options = {}) # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the database or the client. # diff --git a/lib/mongo/index/view.rb b/lib/mongo/index/view.rb index c985da3896..f915de360e 100644 --- a/lib/mongo/index/view.rb +++ b/lib/mongo/index/view.rb @@ -310,7 +310,7 @@ def each(&block) # :timeout_ms (whether it applies to the lifetime of the cursor, or per # iteration). # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the collection or the database or the client. # diff --git a/lib/mongo/session.rb b/lib/mongo/session.rb index 1501d12609..fcb0b805df 100644 --- a/lib/mongo/session.rb +++ b/lib/mongo/session.rb @@ -571,7 +571,7 @@ def with_transaction(options = nil) # - *:mode* -- read preference specified as a symbol; the only valid value is # *:primary*. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the client. # @@ -637,7 +637,7 @@ def start_transaction(options = nil) # @option options :write_concern [ nil | WriteConcern::Base ] The write # concern to use for this operation. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the client. # @@ -719,7 +719,7 @@ def commit_transaction(options=nil) # session.abort_transaction # # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. - # Must a non-negative integer. An explicit value of 0 means infinite. + # Must be a non-negative integer. An explicit value of 0 means infinite. # The default value is unset which means the value is inherited from # the client. # From 54a24c2cb36259b82e8e3f704ba9a60eb20008f9 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 5 Jul 2024 15:44:01 +0200 Subject: [PATCH 6/8] max_time_ms --- lib/mongo/collection.rb | 28 +++++++++++++++--------- lib/mongo/collection/view/aggregation.rb | 3 ++- lib/mongo/collection/view/readable.rb | 6 +++-- lib/mongo/collection/view/writable.rb | 6 +++-- lib/mongo/database.rb | 9 ++++++-- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/lib/mongo/collection.rb b/lib/mongo/collection.rb index f904c041d7..b9cbefee0c 100644 --- a/lib/mongo/collection.rb +++ b/lib/mongo/collection.rb @@ -500,8 +500,9 @@ def drop(opts = {}) # this command. # @option options [ :tailable, :tailable_await ] :cursor_type The type of cursor to use. # @option options [ Integer ] :limit The max number of docs to return from the query. - # @option options [ Integer ] :max_time_ms - # The maximum amount of time to allow the query to run, in milliseconds. + # @option options [ Integer ] :max_time_ms The maximum amount of time to + # allow the query to run, in milliseconds. This option is deprecated, use + # :timeout_ms instead. # @option options [ Hash ] :modifiers A document containing meta-operators modifying the # output or behavior of a query. # @option options [ true | false ] :no_cursor_timeout The server normally times out idle @@ -552,8 +553,9 @@ def find(filter = nil, options = {}) # @option options [ String ] :hint The index to use for the aggregation. # @option options [ Hash ] :let Mapping of variables to use in the pipeline. # See the server documentation for details. - # @option options [ Integer ] :max_time_ms The maximum amount of time in - # milliseconds to allow the aggregation to run. + # @option options [ Integer ] :max_time_ms The maximum amount of time to + # allow the query to run, in milliseconds. This option is deprecated, use + # :timeout_ms instead. # @option options [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. # Must be a non-negative integer. An explicit value of 0 means infinite. @@ -657,7 +659,9 @@ def watch(pipeline = [], options = {}) # # @option options [ Hash ] :hint The index to use. # @option options [ Integer ] :limit The maximum number of documents to count. - # @option options [ Integer ] :max_time_ms The maximum amount of time to allow the command to run. + # @option options [ Integer ] :max_time_ms The maximum amount of time to + # allow the query to run, in milliseconds. This option is deprecated, use + # :timeout_ms instead. # @option options [ Integer ] :skip The number of documents to skip before counting. # @option options [ Hash ] :read The read preference options. # @option options [ Hash ] :collation The collation to use. @@ -750,7 +754,9 @@ def estimated_document_count(options = {}) # @param [ Hash ] filter The documents from which to retrieve the distinct values. # @param [ Hash ] options The distinct command options. # - # @option options [ Integer ] :max_time_ms The maximum amount of time to allow the command to run. + # @option options [ Integer ] :max_time_ms The maximum amount of time to + # allow the query to run, in milliseconds. This option is deprecated, use + # :timeout_ms instead. # @option options [ Hash ] :read The read preference options. # @option options [ Hash ] :collation The collation to use. # @option options [ Session ] :session The session to use. @@ -1001,8 +1007,9 @@ def delete_many(filter = nil, options = {}) # @param [ Integer ] cursor_count The max number of cursors to return. # @param [ Hash ] options The parallel scan command options. # - # @option options [ Integer ] :max_time_ms The maximum amount of time to allow the command - # to run in milliseconds. + # @option options [ Integer ] :max_time_ms The maximum amount of time to + # allow the query to run, in milliseconds. This option is deprecated, use + # :timeout_ms instead. # @option options [ Session ] :session The session to use. # @option options [ :cursor_lifetime | :iteration ] :timeout_mode How to interpret # :timeout_ms (whether it applies to the lifetime of the cursor, or per @@ -1125,8 +1132,9 @@ def update_one(filter, update, options = {}) # @param [ Hash ] filter The filter to use. # @param [ Hash ] options The options. # - # @option options [ Integer ] :max_time_ms The maximum amount of time to allow the command - # to run in milliseconds. + # @option options [ Integer ] :max_time_ms The maximum amount of time to + # allow the query to run, in milliseconds. This option is deprecated, use + # :timeout_ms instead. # @option options [ Hash ] :projection The fields to include or exclude in the returned doc. # @option options [ Hash ] :sort The key and direction pairs by which the result set # will be sorted. diff --git a/lib/mongo/collection/view/aggregation.rb b/lib/mongo/collection/view/aggregation.rb index ab5fb2e5d1..9b190a56b0 100644 --- a/lib/mongo/collection/view/aggregation.rb +++ b/lib/mongo/collection/view/aggregation.rb @@ -53,7 +53,8 @@ class Aggregation # @option options [ Hash ] :let Mapping of variables to use in the pipeline. # See the server documentation for details. # @option options [ Integer ] :max_time_ms The maximum amount of time in - # milliseconds to allow the aggregation to run. + # milliseconds to allow the aggregation to run. This option is deprecated, use + # :timeout_ms instead. # @option options [ Session ] :session The session to use. # @option options [ :cursor_lifetime | :iteration ] :timeout_mode How to interpret # :timeout_ms (whether it applies to the lifetime of the cursor, or per diff --git a/lib/mongo/collection/view/readable.rb b/lib/mongo/collection/view/readable.rb index 4a0ce09ce7..58f7a380ab 100644 --- a/lib/mongo/collection/view/readable.rb +++ b/lib/mongo/collection/view/readable.rb @@ -47,7 +47,8 @@ module Readable # @option options [ Hash ] :let Mapping of variables to use in the pipeline. # See the server documentation for details. # @option options [ Integer ] :max_time_ms The maximum amount of time in - # milliseconds to allow the aggregation to run. + # milliseconds to allow the aggregation to run. This option is deprecated, use + # :timeout_ms instead. # @option options [ Session ] :session The session to use. # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. # Must be a non-negative integer. An explicit value of 0 means infinite. @@ -222,7 +223,8 @@ def count(opts = {}) # MongoDB to use a specific index for the query. Requires server version 3.6+. # @option opts :limit [ Integer ] Max number of docs to count. # @option opts :max_time_ms [ Integer ] The maximum amount of time to allow the - # command to run. + # command to run. This option is deprecated, use + # :timeout_ms instead. # @option opts [ Hash ] :read The read preference options. # @option opts [ Hash ] :collation The collation to use. # @option opts [ Mongo::Session ] :session The session to use for the operation. diff --git a/lib/mongo/collection/view/writable.rb b/lib/mongo/collection/view/writable.rb index 50f8119112..0a1f553b1d 100644 --- a/lib/mongo/collection/view/writable.rb +++ b/lib/mongo/collection/view/writable.rb @@ -38,7 +38,8 @@ module Writable # @param [ Hash ] opts The options. # # @option opts [ Integer ] :max_time_ms The maximum amount of time to allow the command - # to run in milliseconds. + # to run in milliseconds. This option is deprecated, use + # :timeout_ms instead. # @option opts [ Hash ] :projection The fields to include or exclude in the returned doc. # @option opts [ Hash ] :sort The key and direction pairs by which the result set # will be sorted. @@ -149,7 +150,8 @@ def find_one_and_replace(replacement, opts = {}) # @param [ Hash ] opts The options. # # @option opts [ Integer ] :max_time_ms The maximum amount of time to allow the command - # to run in milliseconds. + # to run in milliseconds. This option is deprecated, use + # :timeout_ms instead. # @option opts [ Hash ] :projection The fields to include or exclude in the returned doc. # @option opts [ Hash ] :sort The key and direction pairs by which the result set # will be sorted. diff --git a/lib/mongo/database.rb b/lib/mongo/database.rb index aebd9b65e5..5fb69bc09a 100644 --- a/lib/mongo/database.rb +++ b/lib/mongo/database.rb @@ -434,9 +434,14 @@ def users # @option options [ Hash ] :collation The collation to use. # @option options [ Object ] :comment A user-provided # comment to attach to this command. + # @option options [ Integer ] :max_time_ms The maximum amount of time to + # allow the query to run, in milliseconds. This option is deprecated, use + # :timeout_ms instead. + # @option options [ Integer ] :timeout_ms The operation timeout in milliseconds. + # Must be a non-negative integer. An explicit value of 0 means infinite. + # The default value is unset which means the value is inherited from + # the database or the client. # @option options [ String ] :hint The index to use for the aggregation. - # @option options [ Integer ] :max_time_ms The maximum amount of time in - # milliseconds to allow the aggregation to run. # @option options [ Session ] :session The session to use. # # @return [ Collection::View::Aggregation ] The aggregation object. From bd6ae228e00ea11ee252bc2cbed5c5500e3c4c49 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 5 Jul 2024 15:56:45 +0200 Subject: [PATCH 7/8] max_commit_time_ms --- lib/mongo/session.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mongo/session.rb b/lib/mongo/session.rb index fcb0b805df..be9c1f2a42 100644 --- a/lib/mongo/session.rb +++ b/lib/mongo/session.rb @@ -560,6 +560,7 @@ def with_transaction(options = nil) # # @option options [ Integer ] :max_commit_time_ms The maximum amount of # time to allow a single commitTransaction command to run, in milliseconds. + # This options is deprecated, use :timeout_ms instead. # @option options [ Hash ] :read_concern The read concern options hash, # with the following optional keys: # - *:level* -- the read preference level as a symbol; valid values From ff25297ed5bc3d11952cfe72b8a2ffbf25197278 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov <160598371+comandeo-mongo@users.noreply.github.com> Date: Mon, 8 Jul 2024 17:31:33 +0200 Subject: [PATCH 8/8] Update docs/reference/create-client.txt Co-authored-by: Jamis Buck --- docs/reference/create-client.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/create-client.txt b/docs/reference/create-client.txt index 37deb475bf..f4c66acf4d 100644 --- a/docs/reference/create-client.txt +++ b/docs/reference/create-client.txt @@ -1276,7 +1276,7 @@ default. An explicit value of 0 means infinite. If this option is set and the timeout expires, the driver aborts all blocking work and return control to the user with an error ``Mongo::Error::TimeoutError``. -If this option is set, the driver ignore any deprecated timeout option - +If this option is set, the driver will ignore any deprecated timeout option - ``socket_timeout``, ``wait_queue_timeout``, ``wtimeout``, ``max_time_ms``. ``wtimeout``