<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.mongodb-driver-bulkwritecommand.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'tr',
  ),
  'this' => 
  array (
    0 => 'mongodb-driver-bulkwritecommand.replaceone.php',
    1 => 'MongoDB\\Driver\\BulkWriteCommand::replaceOne',
    2 => 'Add a replaceOne operation',
  ),
  'up' => 
  array (
    0 => 'class.mongodb-driver-bulkwritecommand.php',
    1 => 'MongoDB\\Driver\\BulkWriteCommand',
  ),
  'prev' => 
  array (
    0 => 'mongodb-driver-bulkwritecommand.insertone.php',
    1 => 'MongoDB\\Driver\\BulkWriteCommand::insertOne',
  ),
  'next' => 
  array (
    0 => 'mongodb-driver-bulkwritecommand.updatemany.php',
    1 => 'MongoDB\\Driver\\BulkWriteCommand::updateMany',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mongodb/mongodb/driver/bulkwritecommand/replaceone.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mongodb-driver-bulkwritecommand.replaceone" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\Driver\BulkWriteCommand::replaceOne</h1>
  <p class="verinfo">(mongodb &gt;=2.1.0)</p><p class="refpurpose"><span class="refname">MongoDB\Driver\BulkWriteCommand::replaceOne</span> &mdash; <span class="dc-title">Add a replaceOne operation</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongodb-driver-bulkwritecommand.replaceone-description">
  <h3 class="title">Açıklama</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>MongoDB\Driver\BulkWriteCommand::replaceOne</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$namespace</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span> <code class="parameter">$filter</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span> <code class="parameter">$replacement</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.array.php" class="type array">array</a></span></span> <code class="parameter">$options</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="simpara">
   Add a replaceOne operation to the
   <span class="classname"><a href="class.mongodb-driver-bulkwritecommand.php" class="classname">MongoDB\Driver\BulkWriteCommand</a></span>. The first document
   matching <code class="parameter">filter</code> in the collection identified by
   <code class="parameter">namespace</code> will be replaced.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-mongodb-driver-bulkwritecommand.replaceone-parameters">
  <h3 class="title">Bağımsız Değişkenler</h3>
  <dl>
   
   
    <dt><code class="parameter">namespace</code> (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)</dt>
    <dd>
     <p class="para">
      A fully qualified namespace (e.g. <code class="literal">&quot;databaseName.collectionName&quot;</code>).
     </p>
    </dd>
   

   
   
    <dt><code class="parameter">filter</code> (<span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span>)</dt>
    <dd>
     <p class="para">
      The <a href="https://www.mongodb.com/docs/manual/tutorial/query-documents/" class="link external">&raquo;&nbsp;query predicate</a>.
      An empty predicate will match all documents in the collection.
     </p>
     <blockquote class="note"><p><strong class="note">Bilginize</strong>: 
      <span class="simpara">
       When evaluating query criteria, MongoDB compares types and values according to its own <a href="https://www.mongodb.com/docs/manual/reference/bson-type-comparison-order/" class="link external">&raquo;&nbsp;comparison rules for BSON types</a>, which differs from PHP&#039;s <a href="types.comparisons.php" class="link">comparison</a> and <a href="language.types.type-juggling.php" class="link">type juggling</a> rules. When matching a special BSON type the query criteria should use the respective <a href="mongodb.bson.php" class="link">BSON class</a> (e.g. use <span class="classname"><a href="class.mongodb-bson-objectid.php" class="classname">MongoDB\BSON\ObjectId</a></span> to match an <a href="https://www.mongodb.com/docs/manual/reference/bson-types/#objectid" class="link external">&raquo;&nbsp;ObjectId</a>).
      </span>
     </p></blockquote>
    </dd>
   

   
    <dt><code class="parameter">replacement</code> (<span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span>)</dt>
    <dd>
     <span class="simpara">
      A replacement document.
     </span>
    </dd>
   
   
    <dt><code class="parameter">options</code></dt>
    <dd>
     <p class="para">
      <table class="doctable table">
       <caption><strong>options</strong></caption>
       
        <thead>
         <tr>
          <th>Option</th>
          <th>Type</th>
          <th>Description</th>
          <th>Default</th>
         </tr>

        </thead>

        <tbody class="tbody">
         
         <tr>
          <td>collation</td>
          <td><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span></td>
          <td>
           <p class="para">
            <a href="https://www.mongodb.com/docs/upcoming/reference/collation/" class="link external">&raquo;&nbsp;Collation</a> allows users to specify language-specific rules for string comparison, such as rules for lettercase and accent marks. When specifying collation, the <code class="literal">&quot;locale&quot;</code> field is mandatory; all other collation fields are optional. For descriptions of the fields, see <a href="https://www.mongodb.com/docs/upcoming/reference/collation/#collation-document" class="link external">&raquo;&nbsp;Collation Document</a>.
           </p>
           <p class="para">
            If the collation is unspecified but the collection has a default collation, the operation uses the collation specified for the collection. If no collation is specified for the collection or for the operation, MongoDB uses the simple binary comparison used in prior versions for string comparisons.
           </p>
           <p class="para">
            This option is available in MongoDB 3.4+ and will result in an exception at execution time if specified for an older server version.
           </p>
          </td>
         </tr>


         <tr>
          <td>hint</td>
          <td><span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span></td>
          <td>
           <span class="simpara">
            Index specification. Specify either the index name as a string or
            the index key pattern. If specified, then the query system will only
            consider plans using the hinted index.
           </span>
          </td>
         </tr>

         <tr>
          <td>sort</td>
          <td><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span></td>
          <td>
           <span class="simpara">
            Specify which document the operation replaces if the query matches
            multiple documents. The first document matched by the sort order
            will be replaced.
           </span>
          </td>
         </tr>

         <tr>
          <td>upsert</td>
          <td><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></td>
          <td>
           If <code class="parameter">filter</code> does not match an existing document,
           insert a <em>single</em> document. The document will be
           created from <code class="parameter">replacement</code>.
          </td>
          <td><strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></td>
         </tr>

        </tbody>
       
      </table>

     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongodb-driver-bulkwritecommand.replaceone-returnvalues">
  <h3 class="title">Dönen Değerler</h3>
  <p class="simpara">
   Hiçbir değer dönmez.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongodb-driver-bulkwritecommand.replaceone-errors">
  <h3 class="title">Hatalar/İstisnalar</h3>
  <ul class="simplelist">
   <li>Throws <span class="classname"><a href="class.mongodb-driver-exception-invalidargumentexception.php" class="classname">MongoDB\Driver\Exception\InvalidArgumentException</a></span> on argument parsing errors.</li>
  </ul>
 </div>


 <div class="refsect1 examples" id="refsect1-mongodb-driver-bulkwritecommand.replaceone-examples">
  <h3 class="title">Örnekler</h3>
  <div class="example" id="example-1">
   <p><strong>Örnek 1 <span class="function"><strong>MongoDB\Driver\BulkWriteCommand::replaceOne()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$manager </span><span style="color: #007700">= new </span><span style="color: #0000BB">MongoDB\Driver\Manager</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$bulk </span><span style="color: #007700">= new </span><span style="color: #0000BB">MongoDB\Driver\BulkWriteCommand</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$bulk</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">replaceOne</span><span style="color: #007700">(</span><span style="color: #DD0000">'db.coll'</span><span style="color: #007700">, [</span><span style="color: #DD0000">'x' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">1</span><span style="color: #007700">], [</span><span style="color: #DD0000">'x' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #DD0000">'y' </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">]);<br /><br /></span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #0000BB">$manager</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">executeBulkWriteCommand</span><span style="color: #007700">(</span><span style="color: #0000BB">$bulk</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongodb-driver-bulkwritecommand.replaceone-seealso">
  <h3 class="title">Ayrıca Bakınız</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="mongodb-driver-bulkwritecommand.updateone.php" class="methodname" rel="rdfs-seeAlso">MongoDB\Driver\BulkWriteCommand::updateOne()</a> - Add an updateOne operation</span></li>
   <li><span class="methodname"><a href="mongodb-driver-bulkwritecommand.updatemany.php" class="methodname" rel="rdfs-seeAlso">MongoDB\Driver\BulkWriteCommand::updateMany()</a> - Add an updateMany operation</span></li>
   <li><span class="methodname"><a href="mongodb-driver-manager.executebulkwritecommand.php" class="methodname" rel="rdfs-seeAlso">MongoDB\Driver\Manager::executeBulkWriteCommand()</a> - Execute write operations using the bulkWrite command</span></li>
   <li><span class="classname"><a href="class.mongodb-driver-bulkwritecommandresult.php" class="classname">MongoDB\Driver\BulkWriteCommandResult</a></span></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>