Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 9381

php-manual-en-5.5.7-1.mga4.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>Write Concerns</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongo.readpreferences.html">Read Preferences</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongo.sqltomongo.html">SQL to Mongo Mapping Chart</a></div>
 <div class="up"><a href="mongo.manual.html">Manual</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mongo.writeconcerns" class="chapter">
 <h1>Write Concerns</h1>


 <p class="para">
  MongoDB provides several different ways of selecting how durable a write to
  the database should be. These ways are called <em>Write
  Concerns</em> and span everything from completely ignoring all errors,
  to specifically targetting which servers are required to confirm the write
  before returning the operation.
 </p>
 <p class="para">
  When a write (such as with  <span class="methodname"><a href="mongocollection.insert.html" class="methodname">MongoCollection::insert()</a></span>,
   <span class="methodname"><a href="mongocollection.update.html" class="methodname">MongoCollection::update()</a></span>, and
   <span class="methodname"><a href="mongocollection.remove.html" class="methodname">MongoCollection::remove()</a></span>) is given a Write Concern
  option (<em>&quot;w&quot;</em>) the driver will send the query to MongoDB
  and piggy back a <em>getLastError</em> command
  (<acronym title="getLastError">GLE</acronym>) with the Write Concern option at the same time.
  The server only returns when the Write Concern condition is verified to be
  fullfilled, or the query times out (controlled with the
  <em>&quot;wtimeout&quot;</em> option, <em>10000</em> milliseconds
  is the default).
 </p>

 <div class="warning"><strong class="warning">Warning</strong>
  <p class="para">
   Even though a <em>getLastError</em> command times out the data
   will most likely have been written to the primary server and will be
   replicated to all the secondaries once they have cought up.
  </p>
  <p class="para">
   The typical reasons for a timeout to happen is if you specify a Write
   Concern which requires confirmation from more servers then you currently
   have available.
  </p>
 </div>

 <p class="para">
  When using acknowledged writes and the replica set has failed over, the driver
  will automatically disconnect from the primary, throw an exception, and
  attempt to find a new primary on the next operation (your application must
  decide whether or not to retry the operation on the new primary).
 </p>
 <p class="para">
  When using unacknowledged writes (w=0) and the replica set has failed over,
  there will be no way for the driver to know about the change so it will
  continue and silently fail to write.
 </p>
 <p class="para">
  The default Write Concern for the <a href="class.mongoclient.html" class="classname">MongoClient</a> is
  <em>1</em>: acknowledge write operations.
 </p>


 <p class="para">
  <table id="mongo.writeconcerns.options" class="doctable table">
   <caption><strong>Available Write Concerns</strong></caption>
   
    <thead>
     <tr>
      <th>Write Concern</th>
      <th>Meaning</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">

     <tr>
      <td>w=0</td>
      <td>Unacknowledged</td>
      <td>A write will not be followed up with a <acronym title="getLastError">GLE</acronym> call, and therefore not checked (&quot;fire and forget&quot;)</td>
     </tr>

     <tr>
      <td>w=1</td>
      <td>Acknowledged</td>
      <td>The write will be acknowledged by the server (the primary on replica set configuration)</td>
     </tr>

     <tr>
      <td>w=N</td>
      <td>Replica Set Acknowledged</td>
      <td>The write will be acknowledged by the primary server, and
      replicated to <em>N-1</em> secondaries.</td>
     </tr>

     <tr>
      <td>w=majority</td>
      <td>Majority Acknowledged</td>
      <td>The write will be acknowledged by the majority of the replica set (including the primary). This is a special reserved string.</td>
     </tr>

     <tr>
      <td>w=&lt;tag set&gt;</td>
      <td>Replica Set Tag Set Acknowledged</td>
      <td>The write will be acknowledged by members of the entire tag set</td>
     </tr>

     <tr>
      <td>j=true</td>
      <td>Journaled</td>
      <td>The write will be acknowledged by primary and the journal flushed to disk</td>
     </tr>

    </tbody>
   
  </table>

 </p>
 
 <div class="simplesect">
  <h3 class="title">Using WriteConcerns</h3>
  <p class="para">
   Each of the methods that causes writes
   ( <span class="methodname"><a href="mongocollection.insert.html" class="methodname">MongoCollection::insert()</a></span>,
    <span class="methodname"><a href="mongocollection.update.html" class="methodname">MongoCollection::update()</a></span>, 
    <span class="methodname"><a href="mongocollection.remove.html" class="methodname">MongoCollection::remove()</a></span>, and
    <span class="methodname"><a href="mongocollection.batchinsert.html" class="methodname">MongoCollection::batchInsert()</a></span>) allow an optional
   argument to send a set of options to the MongoDB server. With this option
   array you can set the WriteConcern as the following example illustrates:
  </p>
  <div class="example" id="example-1370">
   <p><strong>Example #1 Passing a WriteConcern to a write operation</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Setting&nbsp;w=0&nbsp;for&nbsp;insert:<br /></span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #0000BB">$someDoc</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">//&nbsp;Setting&nbsp;w=majority&nbsp;for&nbsp;update:<br /></span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">update</span><span style="color: #007700">(</span><span style="color: #0000BB">$someDoc</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$someUpdates</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"majority"</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">//&nbsp;Setting&nbsp;w=5&nbsp;and&nbsp;j=true&nbsp;for&nbsp;remove:<br /></span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">update</span><span style="color: #007700">(</span><span style="color: #0000BB">$someDoc</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"j"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">//&nbsp;Setting&nbsp;w="AllDCs"&nbsp;for&nbsp;batchInsert:<br /></span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">update</span><span style="color: #007700">(array(</span><span style="color: #0000BB">$someDoc1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$someDoc2</span><span style="color: #007700">),&nbsp;array(</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"AllDCs"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
  <p class="para">
   Besides setting WriteConcerns per operation as an option argument, it is
   also possible to set a default WriteConcern in different ways.
  </p>
  <p class="para">
   The first way is through the <a href="" class="link">connection
   string</a>. The connection string accepts the
   <em>journal</em>, <em>w</em>, and
   <em>wTimeoutMS</em> options:
  </p>
  <div class="example" id="example-1371">
   <p><strong>Example #2 Connection string WriteConcerns</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$m&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">MongoClient</span><span style="color: #007700">(</span><span style="color: #DD0000">"mongodb://localhost/?journal=true&amp;w=majority&amp;wTimeoutMS=20000"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>

  <p class="para">
   Since driver version 1.5 it is also possible to call
    <span class="methodname"><strong>MongoDB::setWriteConcern()</strong></span> and
    <span class="methodname"><strong>MongoCollection::setWriteConcern()</strong></span> to set a default
   WriteConcern for all operations created from that specific
   <a href="class.mongodb.html" class="classname">MongoDB</a> or <a href="class.mongocollection.html" class="classname">MongoCollection</a>
   object:
  </p>
  <div class="example" id="example-1372">
   <p><strong>Example #3 MongoDB::setWriteConcern and MongoCollection::setWriteConcern</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$m&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">MongoClient</span><span style="color: #007700">(</span><span style="color: #DD0000">"mongodb://localhost/"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$d&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">demoDb</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$d</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">demoCollection</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;Set&nbsp;w=3&nbsp;on&nbsp;the&nbsp;database&nbsp;object&nbsp;with&nbsp;a&nbsp;timeout&nbsp;of&nbsp;25000ms<br /></span><span style="color: #0000BB">$d</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setWriteConcern</span><span style="color: #007700">(</span><span style="color: #0000BB">3</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">25000</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Set&nbsp;w=majority&nbsp;on&nbsp;the&nbsp;collection&nbsp;object&nbsp;without&nbsp;changing&nbsp;the&nbsp;timeout<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setWriteConcern</span><span style="color: #007700">(</span><span style="color: #DD0000">"majority"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>

 <div class="simplesect">
  <h3 class="title">Unacknowledged Writes</h3>
  <p class="para">
   By not requiring the server to acknowledge writes the writes can be performed
   extremely quickly, but you don&#039;t know whether or not they actually succeeded.
   Writes can fail for a number of reasons: if there are network problems, if a 
   database server goes down, or if the write was simply invalid (e.g., writing 
   to a system collection; or duplicate key errors).
  </p>
  <p class="para">
   While developing, you should always use acknowledged writes (to protect against 
   inadvertent mistakes, such as syntax errors, invalid operators, duplicate key errors and so on).  In 
   production, unacknowledged writes can be used for &quot;unimportant&quot; data.  Unimportant
   data varies on application, but it&#039;s generally automatically (instead of user
   generated) data, such as click tracking or GPS locations, where you can get
   thousands of records per second.
  </p>
  <p class="para">
   It is strongly recommended that you do an acknowledged write at the end of
   series of unacknowledged writes. Doing so will not incur in a too large
   performance penalty, but still allow you to catch any errors that may have
   occurred.
  </p>
  <div class="example" id="mongo.writeconcerns.unacknowledged-example">
   <p><strong>Example #4 Unacknowledged WriteConcern, followed with Acknowledged Write</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #0000BB">$someDoc</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">update</span><span style="color: #007700">(</span><span style="color: #0000BB">$criteria</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$newObj</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #0000BB">$somethingElse</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br />try&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">remove</span><span style="color: #007700">(</span><span style="color: #0000BB">$something</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">));<br />}&nbsp;catch(</span><span style="color: #0000BB">MongoCursorException&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;Handle&nbsp;the&nbsp;exception..&nbsp;*/<br />&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Here&nbsp;we&nbsp;should&nbsp;issue&nbsp;find()&nbsp;queries&nbsp;on&nbsp;the&nbsp;IDs&nbsp;generated&nbsp;for<br />&nbsp;&nbsp;&nbsp;&nbsp;$somethingElse&nbsp;and&nbsp;$someDoc&nbsp;to&nbsp;verify&nbsp;they&nbsp;got&nbsp;written&nbsp;to&nbsp;the&nbsp;database&nbsp;and<br />&nbsp;&nbsp;&nbsp;&nbsp;attempt&nbsp;to&nbsp;figureout&nbsp;where&nbsp;in&nbsp;the&nbsp;chain&nbsp;something&nbsp;happened.&nbsp;*/<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>
    If the last write throws an exception, you know that there&#039;s a problem
    with your database.
   </p></div>
  </div>
 </div>

 <div class="simplesect">
  <h3 class="title">Acknowledged Writes</h3>
  <p class="para">
   These type of write operations will make sure that the database has
   accepted the write operation before returning success. If the write failed,
   it will throw a <a href="class.mongocursorexception.html" class="classname">MongoCursorException</a> with an
   explanation of the failure. The <a href="class.mongoclient.html" class="classname">MongoClient</a> default
   behaviour is to acknowledge the write (w=1).
  </p>
  <p class="para">
   It is possible to specify how many members of an replica set have to
   acknowledge the write (i.e. have it replicated) before the write is deemed
   acknowledged and the operation returns.
   <div class="example" id="mongo.writeconcerns.acknowledged-example">
    <p><strong>Example #5 Acknowledged Writes</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Force&nbsp;acknowledgement&nbsp;from&nbsp;the&nbsp;primary&nbsp;only<br /></span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #0000BB">$doc</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">//&nbsp;Force&nbsp;acknowledgement&nbsp;from&nbsp;the&nbsp;primary,&nbsp;and&nbsp;one&nbsp;other&nbsp;member&nbsp;of&nbsp;the<br />//&nbsp;replica&nbsp;set<br /></span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #0000BB">$doc</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">//&nbsp;Force&nbsp;acknowledgement&nbsp;from&nbsp;the&nbsp;primary,&nbsp;and&nbsp;six&nbsp;other&nbsp;members&nbsp;of&nbsp;the<br />//&nbsp;replica&nbsp;set&nbsp;(you&nbsp;probably&nbsp;never&nbsp;should&nbsp;do&nbsp;this):<br /></span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #0000BB">$doc</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">7</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>
     Keep in mind to select your Write Concern carefully. If you have a
     replica set with 5 members, and you select Write Concern of
     <em>4</em> you will risk the write blocking forever when one
     member of the replica set goes down for maintenance or a temporary network
     outage happens.
    </p></div>
   </div>
  </p>
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="para">
    Passing in a string value for Write Concern has a specific meaning
    (Replica Set Tag Set Acknowledged). Please be careful of
    <em class="emphasis">NOT</em> using string values for numbers (i.e.
    <em>array(&quot;w&quot; =&gt; &quot;1&quot;)</em>) as it will be treated as a tag set
    name.
   </p>
  </div>
 </div>

 <div class="simplesect">
  <h3 class="title">Majority Acknowledged Writes</h3>
  <p class="para">
   Using the special <em>majority</em> Write Concern option is the
   recommended way for writes that are required to survive the apocalypse, as
   it will ensure the majority of your replica set will have the write and will
   therefore be guaranteed to survive all usual suspect outage scenarios.
  </p>
  <div class="example" id="mongo.writeconcerns.majority.acknowledged-example">
   <p><strong>Example #6 Majority Acknowledged Write</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #0000BB">$someDoc</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"majority"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>

 

 <div class="simplesect">
  <h3 class="title">Journaled Writes</h3>
  <p class="para">
   When connecting to a replica set the default Write Concern is only to have
   the primary server acknowledge the write. There is however a 100ms window
   until the write gets journaled and flushed to disk. It is possible to force
   the write to be journaled before acknowledging the write by setting the
   <em>j</em> option:
   <div class="example" id="mongo.writeconcerns.journalled">
    <p><strong>Example #7 Acknowledged and Journaled Write</strong></p>
    <div class="example-contents"><p>Forcing journal flush</p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$options&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"w"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"j"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">,<br />);<br />try&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #0000BB">$document</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$options</span><span style="color: #007700">);<br />}&nbsp;catch(</span><span style="color: #0000BB">MongoCursorException&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;handle&nbsp;the&nbsp;exception&nbsp;*/<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

 <div class="simplesect">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li class="member">
    <a href="http://docs.mongodb.org/manual/applications/replication/#replica-set-write-concern" class="link external">&raquo;&nbsp;MongoDB WriteConcern docs</a>
   </li>
  </ul>
 </div>

 <div class="simplesect">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>1.3.0</td>
      <td>
       <a href="class.mongoclient.html" class="classname">MongoClient</a> was introduced and defaults to
       <a href="mongo.writeconcerns.html#mongo.writeconcerns.acknowledged" class="link">acknowledged</a> writes.
       The deprecated <a href="class.mongo.html" class="classname">Mongo</a> defaults to unacknowledged
       writes.
      </td>
     </tr>

     <tr>
      <td>1.3.0</td>
      <td>
       The <em>&quot;safe&quot;</em> write option has been deprecated and is
       not available with the new <a href="class.mongoclient.html" class="classname">MongoClient</a> class.
       Use the <em>&quot;w&quot;</em> option instead.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>

</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongo.readpreferences.html">Read Preferences</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongo.sqltomongo.html">SQL to Mongo Mapping Chart</a></div>
 <div class="up"><a href="mongo.manual.html">Manual</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>