<section>
 <h1 class="contains-headerlink leafygreen-ui-41fr9s" weight="medium">
  Hedged Read Option
  <a class="headerlink leafygreen-ui-1kepx47" href="#hedged-read-option" title="Permalink to this heading">
   <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
    <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
    </path>
    <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
    </path>
   </svg>
   <div class="css-1btu0w3 evvkmar0" id="hedged-read-option">
   </div>
  </a>
 </h1>
 <div class="leafygreen-ui-a5yxub">
  <p class="css-1cmx2d4 ef7gu8j0">
   On this page
  </p>
  <ul class="css-1qb0mst ef7gu8j1">
   <li class="leafygreen-ui-1e7a0ei">
    <a class="lg-ui-0001 leafygreen-ui-e98ikf" href="#enable-hedged-reads" target="_self">
     <span>
      Enable Hedged Reads
     </span>
    </a>
   </li>
   <li class="leafygreen-ui-1jqtqlb">
    <a class="lg-ui-0001 leafygreen-ui-cpmeq5" href="#additional-information" target="_self">
     <span>
      Additional Information
     </span>
    </a>
   </li>
  </ul>
 </div>
 <div class="leafygreen-ui-85da11" role="note">
  <h2 class="leafygreen-ui-1ac4g5h">
   Important
  </h2>
  <div class="leafygreen-ui-9mycqc">
   <p class="leafygreen-ui-1kp3ins">
    Starting in MongoDB 8.0, hedged reads are deprecated. Queries that
specify the read preference
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/core/read-preference/#mongodb-readmode-nearest">
     <code class="leafygreen-ui-1l06pbn">
      nearest
     </code>
    </a>
    no longer use hedged
reads by default. If you explicitly specify a hedged read, MongoDB
performs a hedged read and logs a warning.
   </p>
  </div>
 </div>
 <p class="leafygreen-ui-1kp3ins">
  You can specify the use of
  <a class="leafygreen-ui-tqgtui" href="/docs/manual/core/sharded-cluster-query-router/#std-label-mongos-hedged-reads">
   hedged reads
  </a>
  for
non-
  <code class="leafygreen-ui-1l06pbn">
   primary
  </code>
  <a class="leafygreen-ui-tqgtui" href="/docs/manual/core/read-preference/#std-label-read-preference">
   read preferences
  </a>
  on sharded
clusters.
 </p>
 <p class="leafygreen-ui-1kp3ins">
  With hedged reads, the
  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
   <code class="leafygreen-ui-1l06pbn">
    mongos
   </code>
  </a>
  instances can route read
operations to two replica set members per each queried shard and return
results from the first respondent per shard.
 </p>
 <p class="leafygreen-ui-1kp3ins">
  Hedged reads are supported for the following operations:
 </p>
 <table class="hlist">
  <tbody>
   <tr>
    <td>
     <ul class="simple">
      <li class="leafygreen-ui-d7p7b6">
       <p class="leafygreen-ui-1kp3ins">
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/collStats/#mongodb-dbcommand-dbcmd.collStats">
         <code class="leafygreen-ui-1l06pbn">
          collStats
         </code>
        </a>
       </p>
      </li>
      <li class="leafygreen-ui-d7p7b6">
       <p class="leafygreen-ui-1kp3ins">
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/count/#mongodb-dbcommand-dbcmd.count">
         <code class="leafygreen-ui-1l06pbn">
          count
         </code>
        </a>
       </p>
      </li>
      <li class="leafygreen-ui-d7p7b6">
       <p class="leafygreen-ui-1kp3ins">
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/dataSize/#mongodb-dbcommand-dbcmd.dataSize">
         <code class="leafygreen-ui-1l06pbn">
          dataSize
         </code>
        </a>
       </p>
      </li>
      <li class="leafygreen-ui-d7p7b6">
       <p class="leafygreen-ui-1kp3ins">
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/dbStats/#mongodb-dbcommand-dbcmd.dbStats">
         <code class="leafygreen-ui-1l06pbn">
          dbStats
         </code>
        </a>
       </p>
      </li>
      <li class="leafygreen-ui-d7p7b6">
       <p class="leafygreen-ui-1kp3ins">
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/distinct/#mongodb-dbcommand-dbcmd.distinct">
         <code class="leafygreen-ui-1l06pbn">
          distinct
         </code>
        </a>
       </p>
      </li>
     </ul>
    </td>
    <td>
     <ul class="simple">
      <li class="leafygreen-ui-d7p7b6">
       <p class="leafygreen-ui-1kp3ins">
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/filemd5/#mongodb-dbcommand-dbcmd.filemd5">
         <code class="leafygreen-ui-1l06pbn">
          filemd5
         </code>
        </a>
       </p>
      </li>
      <li class="leafygreen-ui-d7p7b6">
       <p class="leafygreen-ui-1kp3ins">
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/find/#mongodb-dbcommand-dbcmd.find">
         <code class="leafygreen-ui-1l06pbn">
          find
         </code>
        </a>
       </p>
      </li>
      <li class="leafygreen-ui-d7p7b6">
       <p class="leafygreen-ui-1kp3ins">
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/listCollections/#mongodb-dbcommand-dbcmd.listCollections">
         <code class="leafygreen-ui-1l06pbn">
          listCollections
         </code>
        </a>
       </p>
      </li>
      <li class="leafygreen-ui-d7p7b6">
       <p class="leafygreen-ui-1kp3ins">
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/listIndexes/#mongodb-dbcommand-dbcmd.listIndexes">
         <code class="leafygreen-ui-1l06pbn">
          listIndexes
         </code>
        </a>
       </p>
      </li>
      <li class="leafygreen-ui-d7p7b6">
       <p class="leafygreen-ui-1kp3ins">
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/planCacheListFilters/#mongodb-dbcommand-dbcmd.planCacheListFilters">
         <code class="leafygreen-ui-1l06pbn">
          planCacheListFilters
         </code>
        </a>
       </p>
      </li>
     </ul>
    </td>
   </tr>
  </tbody>
 </table>
 <p class="leafygreen-ui-1kp3ins">
  To specify hedged read for a read preference, use the hedged read option for
read preferences.
 </p>
 <section>
  <h2 class="contains-headerlink leafygreen-ui-19f71ei" weight="medium">
   Enable Hedged Reads
   <a class="headerlink leafygreen-ui-1kepx47" href="#enable-hedged-reads" title="Permalink to this heading">
    <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
     <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
     </path>
     <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
     </path>
    </svg>
    <div class="css-1btu0w3 evvkmar0" id="enable-hedged-reads">
    </div>
   </a>
  </h2>
  <p class="leafygreen-ui-1kp3ins">
   To use hedged reads, enable the hedge read option for non-
   <code class="leafygreen-ui-1l06pbn">
    primary
   </code>
   read preferences.
  </p>
  <ul class="leafygreen-ui-rioki0">
   <li class="leafygreen-ui-d7p7b6">
    <p class="leafygreen-ui-1kp3ins">
     When using the drivers, refer to the
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="https://www.mongodb.com/docs/drivers/" target="_self">
      <span>
       drivers' read preference API
       <!-- -->
       .
      </span>
     </a>
    </p>
   </li>
   <li class="leafygreen-ui-d7p7b6">
    <p class="leafygreen-ui-1kp3ins">
     When using
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="https://www.mongodb.com/docs/mongodb-shell/#mongodb-binary-bin.mongosh" target="_self">
      <span>
       <code class="leafygreen-ui-1l06pbn">
        mongosh
       </code>
      </span>
     </a>
     , you can use the helper
methods
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/cursor.readPref/#mongodb-method-cursor.readPref">
      <code class="leafygreen-ui-1l06pbn">
       cursor.readPref()
      </code>
     </a>
     and
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/Mongo.setReadPref/#mongodb-method-Mongo.setReadPref">
      <code class="leafygreen-ui-1l06pbn">
       Mongo.setReadPref()
      </code>
      .
     </a>
    </p>
   </li>
  </ul>
 </section>
 <section>
  <h2 class="contains-headerlink leafygreen-ui-19f71ei" weight="medium">
   Additional Information
   <a class="headerlink leafygreen-ui-1kepx47" href="#additional-information" title="Permalink to this heading">
    <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
     <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
     </path>
     <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
     </path>
    </svg>
    <div class="css-1btu0w3 evvkmar0" id="additional-information">
    </div>
   </a>
  </h2>
  <p class="leafygreen-ui-1kp3ins">
   For more information on hedged reads, see
   <a class="leafygreen-ui-tqgtui" href="/docs/manual/core/sharded-cluster-query-router/#std-label-mongos-hedged-reads">
    Hedged Reads
    <!-- -->
    .
   </a>
  </p>
  <section>
   <h3 class="contains-headerlink leafygreen-ui-15ajumo" weight="medium">
    Member Selection with Hedged Reads
    <a class="headerlink leafygreen-ui-1kepx47" href="#member-selection-with-hedged-reads" title="Permalink to this heading">
     <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
      <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
      </path>
      <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
      </path>
     </svg>
     <div class="css-1btu0w3 evvkmar0" id="member-selection-with-hedged-reads">
     </div>
    </a>
   </h3>
   <p class="leafygreen-ui-1kp3ins">
    For details on member selection for hedged reads, see
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/core/read-preference-mechanics/#std-label-read-preference-mechanics-sharded-cluster">
     Read Preference and Shards
     <!-- -->
     .
    </a>
   </p>
  </section>
  <section>
   <h3 class="contains-headerlink leafygreen-ui-15ajumo" weight="medium">
    Hedged Reads Diagnostics
    <a class="headerlink leafygreen-ui-1kepx47" href="#hedged-reads-diagnostics" title="Permalink to this heading">
     <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
      <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
      </path>
      <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
      </path>
     </svg>
     <div class="css-1btu0w3 evvkmar0" id="hedged-reads-diagnostics">
     </div>
    </a>
   </h3>
   <p class="leafygreen-ui-1kp3ins">
    The command
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/serverStatus/#mongodb-dbcommand-dbcmd.serverStatus">
     <code class="leafygreen-ui-1l06pbn">
      serverStatus
     </code>
    </a>
    and its corresponding
    <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="https://www.mongodb.com/docs/mongodb-shell/#mongodb-binary-bin.mongosh" target="_self">
     <span>
      <code class="leafygreen-ui-1l06pbn">
       mongosh
      </code>
     </span>
    </a>
    method
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.serverStatus/#mongodb-method-db.serverStatus">
     <code class="leafygreen-ui-1l06pbn">
      db.serverStatus()
     </code>
    </a>
    return
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/serverStatus/#mongodb-serverstatus-serverstatus.hedgingMetrics">
     <code class="leafygreen-ui-1l06pbn">
      hedgingMetrics
     </code>
     .
    </a>
   </p>
  </section>
 </section>
</section>
