<!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\WriteConcern class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mongodb-driver-session.starttransaction.html">MongoDB\Driver\Session::startTransaction</a></div> <div class="next" style="text-align: right; float: right;"><a href="mongodb-driver-writeconcern.bsonserialize.html">MongoDB\Driver\WriteConcern::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-writeconcern" class="reference"> <h1 class="title">The MongoDB\Driver\WriteConcern class</h1> <div class="partintro"><p class="verinfo">(mongodb >=1.0.0)</p> <div class="section" id="mongodb-driver-writeconcern.intro"> <h2 class="title">Introduction</h2> <p class="para"> <strong class="classname">MongoDB\Driver\WriteConcern</strong> describes the level of acknowledgement requested from MongoDB for write operations to a standalone <em>mongod</em> or to replica sets or to sharded clusters. In sharded clusters, <em>mongos</em> instances will pass the write concern on to the shards. </p> </div> <div class="section" id="mongodb-driver-writeconcern.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\WriteConcern</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-writeconcern.html#mongodb-driver-writeconcern.constants.majority"><var class="varname">MAJORITY</var></a></var> <span class="initializer"> = "majority"</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-writeconcern.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-writeconcern.construct.html" class="methodname">__construct</a></span> ( <span class="methodparam"><span class="type"><span class="type string|integer">string|integer</span></span> <code class="parameter">$w</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$wtimeout</code></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$journal</code></span> ]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">boolean|null</span> <span class="methodname"><a href="mongodb-driver-writeconcern.getjournal.html" class="methodname">getJournal</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">string|integer|null</span> <span class="methodname"><a href="mongodb-driver-writeconcern.getw.html" class="methodname">getW</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">int</span> <span class="methodname"><a href="mongodb-driver-writeconcern.getwtimeout.html" class="methodname">getWtimeout</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-writeconcern.isdefault.html" class="methodname">isDefault</a></span> ( <span class="methodparam">void</span> )</div> }</div> </div> <div class="section" id="mongodb-driver-writeconcern.constants"> <h2 class="title">Predefined Constants</h2> <dl> <dt id="mongodb-driver-writeconcern.constants.majority"><strong><code>MongoDB\Driver\WriteConcern::MAJORITY</code></strong></dt> <dd> <p class="para"> Majority of all the members in the set; arbiters, non-voting members, passive members, hidden members and delayed members are all included in the definition of majority write concern. </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.2.0</td> <td> Implements <span class="interfacename"><a href="class.mongodb-bson-serializable.html" class="interfacename">MongoDB\BSON\Serializable</a></span>. </td> </tr> </tbody> </table> </p> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="mongodb-driver-writeconcern.bsonserialize.html">MongoDB\Driver\WriteConcern::bsonSerialize</a> — Returns an object for BSON serialization</li><li><a href="mongodb-driver-writeconcern.construct.html">MongoDB\Driver\WriteConcern::__construct</a> — Create a new WriteConcern</li><li><a href="mongodb-driver-writeconcern.getjournal.html">MongoDB\Driver\WriteConcern::getJournal</a> — Returns the WriteConcern's "journal" option</li><li><a href="mongodb-driver-writeconcern.getw.html">MongoDB\Driver\WriteConcern::getW</a> — Returns the WriteConcern's "w" option</li><li><a href="mongodb-driver-writeconcern.getwtimeout.html">MongoDB\Driver\WriteConcern::getWtimeout</a> — Returns the WriteConcern's "wtimeout" option</li><li><a href="mongodb-driver-writeconcern.isdefault.html">MongoDB\Driver\WriteConcern::isDefault</a> — Checks if this is the default write 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-session.starttransaction.html">MongoDB\Driver\Session::startTransaction</a></div> <div class="next" style="text-align: right; float: right;"><a href="mongodb-driver-writeconcern.bsonserialize.html">MongoDB\Driver\WriteConcern::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>