diff --git a/docs/tutorials/ruby-driver-crud-operations.txt b/docs/tutorials/ruby-driver-crud-operations.txt index 77f6615224..27ebdc8ea1 100644 --- a/docs/tutorials/ruby-driver-crud-operations.txt +++ b/docs/tutorials/ruby-driver-crud-operations.txt @@ -293,7 +293,8 @@ Read Preference Read preference determines the candidate :manual:`replica set` members to which a query or command can be sent. They consist of a **mode** -specified as a symbol, an array of hashes known as **tag_sets**, and two +specified as a symbol, an array of hashes known as **tag_sets**, +the ``hedge`` option, which is a Hash specifying hedged read behavior, and two timing options: **local_threshold** and **server_selection_timeout**. ``local_threshold`` @@ -378,6 +379,31 @@ A tag set that is an empty document matches any server, because the empty tag set is a subset of any tag set. This means the default ``tag_sets`` parameter ``[{}]`` matches all servers. +Hedge +~~~~~ + +The ``hedge`` parameter is a Hash that specifies whether the server should use +hedged reads. With hedged reads, sharded clusters can route read operations to +two replica set members and return results from the first respondent. + +The ``hedge`` option may only be specified on non-primary read preferences. It +must be provided as Hash with the key ``enabled`` set to ``true`` or ``false``. + +.. code-block:: ruby + + client = Mongo::Client.new( + [ '127.0.0.1:27017' ], + read: { mode: :secondary, hedge: { enabled: true } }, + ) + +See the :manual:`MongoDB Manual ` for +more information about hedged reads. + +.. note:: + + The ``hedge`` option is only available on MongoDB server versions 4.4 and newer. + Attempting to use this option on older server versions will result in an error. + .. _ruby-driver-updating: Updating