Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 957

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The MongoDB\Driver\ReadConcern class</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongodb-driver-readpreference.gettagsets.html">MongoDB\Driver\ReadPreference::getTagSets</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongodb-driver-readconcern.bsonserialize.html">MongoDB\Driver\ReadConcern::bsonSerialize</a></div>
 <div class="up"><a href="book.mongodb.html">MongoDB\Driver</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.mongodb-driver-readconcern" class="reference">

 <h1 class="title">The MongoDB\Driver\ReadConcern class</h1>
 

 <div class="partintro"><p class="verinfo">(mongodb &gt;=1.1.0)</p>


  <div class="section" id="mongodb-driver-readconcern.intro">
   <h2 class="title">Introduction</h2>
   <p class="para">
    <strong class="classname">MongoDB\Driver\ReadConcern</strong> controls the level of
    isolation for read operations for replica sets and replica set shards. This
    option requires MongoDB 3.2 or later.
   </p>
  </div>


  <div class="section" id="mongodb-driver-readconcern.synopsis">
   <h2 class="title">Class synopsis</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="modifier">final</span>
     <span class="ooclass">
      <strong class="classname">MongoDB\Driver\ReadConcern</strong>
     </span>

     <span class="oointerface">implements 
      <span class="interfacename"><a href="class.mongodb-bson-serializable.html" class="interfacename">MongoDB\BSON\Serializable</a></span>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Constants */</div>
    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">string</span>
      <var class="fieldsynopsis_varname"><a href="class.mongodb-driver-readconcern.html#mongodb-driver-readconcern.constants.linearizable"><var class="varname">AVAILABLE</var></a></var>
     <span class="initializer"> = &quot;available&quot;</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">string</span>
      <var class="fieldsynopsis_varname"><a href="class.mongodb-driver-readconcern.html#mongodb-driver-readconcern.constants.linearizable"><var class="varname">LINEARIZABLE</var></a></var>
     <span class="initializer"> = &quot;linearizable&quot;</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">string</span>
      <var class="fieldsynopsis_varname"><a href="class.mongodb-driver-readconcern.html#mongodb-driver-readconcern.constants.local"><var class="varname">LOCAL</var></a></var>
     <span class="initializer"> = &quot;local&quot;</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">string</span>
      <var class="fieldsynopsis_varname"><a href="class.mongodb-driver-readconcern.html#mongodb-driver-readconcern.constants.majority"><var class="varname">MAJORITY</var></a></var>
     <span class="initializer"> = &quot;majority&quot;</span>
    ;</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">object</span> <span class="methodname"><a href="mongodb-driver-readconcern.bsonserialize.html" class="methodname">bsonSerialize</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="mongodb-driver-readconcern.construct.html" class="methodname">__construct</a></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$level</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">string|null</span> <span class="methodname"><a href="mongodb-driver-readconcern.getlevel.html" class="methodname">getLevel</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="mongodb-driver-readconcern.isdefault.html" class="methodname">isDefault</a></span>
    ( <span class="methodparam">void</span>
   )</div>

   }</div>


  </div>
  

  <div class="section" id="mongodb-driver-readconcern.constants">
   <h2 class="title">Predefined Constants</h2>
   <dl>


    
     <dt id="mongodb-driver-readconcern.constants.available"><strong><code>MongoDB\Driver\ReadConcern::AVAILABLE</code></strong></dt>

     <dd>

      <p class="para">
       Default for reads against secondaries when
       <em>afterClusterTime</em>and <em>level</em> are
       unspecified.
      </p>
      <p class="para">
       The query returns the instance&#039;s most recent data. Provides no
       guarantee that the data has been written to a majority of the replica set
       members (i.e. may be rolled back).
      </p>
      <p class="para">
       For unsharded collections (including collections in a standalone
       deployment or a replica set deployment), <em>&quot;local&quot;</em> and
       <em>&quot;available&quot;</em> read concerns behave identically.
      </p>
      <p class="para">
       For a sharded cluster, <em>&quot;available&quot;</em> read concern
       provides greater tolerance for partitions since it does not wait to
       ensure consistency guarantees. However, a query with
       <em>&quot;available&quot;</em> read concern may return orphan documents
       if the shard is undergoing chunk migrations since the
       <em>&quot;available&quot;</em> read concern, unlike
       <em>&quot;local&quot;</em> read concern, does not contact the
       shard&#039;s primary nor the config servers for updated metadata.
      </p>
     </dd>

    

    
     <dt id="mongodb-driver-readconcern.constants.linearizable"><strong><code>MongoDB\Driver\ReadConcern::LINEARIZABLE</code></strong></dt>

     <dd>

      <p class="para">
       The query returns data that reflects all successful writes issued with a
       write concern of <em>&quot;majority&quot;</em> <em class="emphasis">and</em>
       acknowledged prior to the start of the read operation. For replica sets
       that run with <em>writeConcernMajorityJournalDefault</em> set
       to <strong><code>TRUE</code></strong>, linearizable read concern returns data that will never be
       rolled back.
      </p>
      <p class="para">
       With <em>writeConcernMajorityJournalDefault</em> set to
       <strong><code>FALSE</code></strong>, MongoDB will not wait for <em>w: &quot;majority&quot;</em>
       writes to be durable before acknowledging the writes. As such,
       <em>&quot;majority&quot;</em> write operations could possibly roll back
       in the event of a loss of a replica set member.
      </p>
      <p class="para">
       You can specify linearizable read concern for read operations on the
       primary only.
      </p>
      <p class="para">
       Linearizable read concern guarantees only apply if read
       operations specify a query filter that uniquely identifies a single
       document.
      </p>
      <div class="tip"><strong class="tip">Tip</strong>
       <p class="simpara">
        Always use <em>maxTimeMS</em> with linearizable read concern
        in case a majority of data bearing members are unavailable.
        <em>maxTimeMS</em> ensures that the operation does not block
        indefinitely and instead ensures that the operation returns an error if
        the read concern cannot be fulfilled.
       </p>
      </div>
      <p class="para">
       Linearizable read concern requires MongoDB 3.4.
      </p>
     </dd>

    

    
     <dt id="mongodb-driver-readconcern.constants.local"><strong><code>MongoDB\Driver\ReadConcern::LOCAL</code></strong></dt>

     <dd>

      <p class="para">
       Default for reads against primary if <em>level</em> is
       unspecified and for reads against secondaries if <em>level</em>
       is unspecified but <em>afterClusterTime</em> is specified.
      </p>
      <p class="para">
       The query returns the instance&#039;s most recent data. Provides no
       guarantee that the data has been written to a majority of the replica set
       members (i.e. may be rolled back).
      </p>
     </dd>

    

    
     <dt id="mongodb-driver-readconcern.constants.majority"><strong><code>MongoDB\Driver\ReadConcern::MAJORITY</code></strong></dt>

     <dd>

      <p class="para">
       The query returns the instance&#039;s most recent data acknowledged as
       having been written to a majority of members in the replica set.
      </p>
      <p class="para">
       To use read concern level of <em>&quot;majority&quot;</em>, replica sets
       must use WiredTiger storage engine and election protocol version 1.
      </p>
     </dd>

    

   </dl>

  </div>


  <div class="section">
   <h2 class="title">Changelog</h2>
   <p class="para">
    <table class="doctable informaltable">
     
      <thead>
       <tr>
        <th>Version</th>
        <th>Description</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td>1.4.0</td>
        <td>
         <p class="para">
          Added the <strong><code>MongoDB\Driver\ReadConcern::AVAILABLE</code></strong>
          constant.
         </p>
        </td>
       </tr>

       <tr>
        <td>1.2.0</td>
        <td>
         <p class="para">
          Added the
          <strong><code>MongoDB\Driver\ReadConcern::LINEARIZABLE</code></strong>
          constant.
         </p>
         <p class="para">
          Implements <span class="interfacename"><a href="class.mongodb-bson-serializable.html" class="interfacename">MongoDB\BSON\Serializable</a></span>.
         </p>
        </td>
       </tr>

      </tbody>
     
    </table>

   </p>
  </div>

  <div class="section" id="mongodb-driver-readconcern.seealso">
   <h2 class="title">See Also</h2>
  <ul class="simplelist">
   <li class="member"><a href="https://docs.mongodb.com/manual/reference/read-concern/" class="link external">&raquo;&nbsp;Read Concern reference</a></li>
  </ul>
  </div>

 </div>

 





























<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="mongodb-driver-readconcern.bsonserialize.html">MongoDB\Driver\ReadConcern::bsonSerialize</a> — Returns an object for BSON serialization</li><li><a href="mongodb-driver-readconcern.construct.html">MongoDB\Driver\ReadConcern::__construct</a> — Create a new ReadConcern</li><li><a href="mongodb-driver-readconcern.getlevel.html">MongoDB\Driver\ReadConcern::getLevel</a> — Returns the ReadConcern's &quot;level&quot; option</li><li><a href="mongodb-driver-readconcern.isdefault.html">MongoDB\Driver\ReadConcern::isDefault</a> — Checks if this is the default read concern</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongodb-driver-readpreference.gettagsets.html">MongoDB\Driver\ReadPreference::getTagSets</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongodb-driver-readconcern.bsonserialize.html">MongoDB\Driver\ReadConcern::bsonSerialize</a></div>
 <div class="up"><a href="book.mongodb.html">MongoDB\Driver</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>