<?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-server.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'mongodb-driver-server.executewritecommand.php',
    1 => 'MongoDB\\Driver\\Server::executeWriteCommand',
    2 => 'Execute a database command that writes on this server',
  ),
  'up' => 
  array (
    0 => 'class.mongodb-driver-server.php',
    1 => 'MongoDB\\Driver\\Server',
  ),
  'prev' => 
  array (
    0 => 'mongodb-driver-server.executereadwritecommand.php',
    1 => 'MongoDB\\Driver\\Server::executeReadWriteCommand',
  ),
  'next' => 
  array (
    0 => 'mongodb-driver-server.gethost.php',
    1 => 'MongoDB\\Driver\\Server::getHost',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mongodb/mongodb/driver/server/executewritecommand.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mongodb-driver-server.executewritecommand" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\Driver\Server::executeWriteCommand</h1>
  <p class="verinfo">(mongodb &gt;=1.4.0)</p><p class="refpurpose"><span class="refname">MongoDB\Driver\Server::executeWriteCommand</span> &mdash; <span class="dc-title">Execute a database command that writes on this server</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongodb-driver-server.executewritecommand-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><strong>MongoDB\Driver\Server::executeWriteCommand</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$db</code></span>, <span class="methodparam"><span class="type"><a href="class.mongodb-driver-command.php" class="type MongoDB\Driver\Command">MongoDB\Driver\Command</a></span> <code class="parameter">$command</code></span>, <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>): <span class="type"><a href="class.mongodb-driver-cursor.php" class="type MongoDB\Driver\Cursor">MongoDB\Driver\Cursor</a></span></div>

  <p class="para rdfs-comment">
   Executes the command on this server.
  </p>
  <p class="para">
   This method will apply logic that is specific to commands that write (e.g.
   <a href="https://www.mongodb.com/docs/manual/reference/command/drop/" class="link external">&raquo;&nbsp;drop</a>).
   The default value for the <code class="literal">&quot;writeConcern&quot;</code> option will be
   inferred from an active transaction (indicated by the
   <code class="literal">&quot;session&quot;</code> option), followed by the
   <a href="mongodb-driver-manager.construct.php#mongodb-driver-manager.construct-uri" class="link">connection URI</a>.
  </p>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <span class="simpara">
    This method is not intended to be used to execute
    <a href="https://www.mongodb.com/docs/manual/reference/command/insert/" class="link external">&raquo;&nbsp;insert</a>,
    <a href="https://www.mongodb.com/docs/manual/reference/command/update/" class="link external">&raquo;&nbsp;update</a>,
    or <a href="https://www.mongodb.com/docs/manual/reference/command/delete/" class="link external">&raquo;&nbsp;delete</a>
    commands. Users are encouraged to use
    <span class="function"><a href="mongodb-driver-server.executebulkwrite.php" class="function">MongoDB\Driver\Server::executeBulkWrite()</a></span> for those
    operations.
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongodb-driver-server.executewritecommand-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
   
    <dt><code class="parameter">db</code> (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)</dt>
    <dd>
     <p class="para">
      The name of the database on which to execute the command.
     </p>
    </dd>
   

   
   
    <dt><code class="parameter">command</code> (<span class="classname"><a href="class.mongodb-driver-command.php" class="classname">MongoDB\Driver\Command</a></span>)</dt>
    <dd>
     <p class="para">
      Der auszuführende Befehl.
     </p>
    </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>
         </tr>

        </thead>

        <tbody class="tbody">
         
         <tr>
          <td>session</td>
          <td><span class="classname"><a href="class.mongodb-driver-session.php" class="classname">MongoDB\Driver\Session</a></span></td>
          <td>
           <p class="para">
            Eine Session, die mit dem Vorgang verknüpft werden soll.
           </p>
          </td>
         </tr>


         
         <tr>
          <td>writeConcern</td>
          <td><span class="classname"><a href="class.mongodb-driver-writeconcern.php" class="classname">MongoDB\Driver\WriteConcern</a></span></td>
          <td>
           <p class="para">
            Eine Schreibanweisung (Write Concern), das auf den Vorgang
            angewendet werden soll.
           </p>
          </td>
         </tr>


        </tbody>
       
      </table>

     </p>
     
     <div class="warning"><strong class="warning">Warnung</strong>
      <p class="para">
       If you are using a <code class="literal">&quot;session&quot;</code> which has a transaction
       in progress, you cannot specify a <code class="literal">&quot;readConcern&quot;</code> or
       <code class="literal">&quot;writeConcern&quot;</code> option. This will result in an
       <span class="classname"><a href="class.mongodb-driver-exception-invalidargumentexception.php" class="classname">MongoDB\Driver\Exception\InvalidArgumentException</a></span>
       being thrown. Instead, you should set these two options when you create
       the transaction with
       <span class="methodname"><a href="mongodb-driver-session.starttransaction.php" class="methodname">MongoDB\Driver\Session::startTransaction()</a></span>.
      </p>
     </div>

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


 <div class="refsect1 returnvalues" id="refsect1-mongodb-driver-server.executewritecommand-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">Gibt bei Erfolg einen <span class="classname"><a href="class.mongodb-driver-cursor.php" class="classname">MongoDB\Driver\Cursor</a></span> zurück.</p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongodb-driver-server.executewritecommand-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <ul class="simplelist">
   <li>Wirft eine <span class="classname"><a href="class.mongodb-driver-exception-invalidargumentexception.php" class="classname">MongoDB\Driver\Exception\InvalidArgumentException</a></span>, wenn die Option <code class="literal">&quot;session&quot;</code> mit einer zugehörigen Transaktion in Kombination mit einer der Optionen <code class="literal">&quot;readConcern&quot;</code> oder <code class="literal">&quot;writeConcern&quot;</code> verwendet wird.</li>
   <li>Wirft eine <span class="classname"><a href="class.mongodb-driver-exception-invalidargumentexception.php" class="classname">MongoDB\Driver\Exception\InvalidArgumentException</a></span>, wenn die Option <code class="literal">&quot;session&quot;</code> in Kombination mit einer unbestätigten Schreibanweisung verwendet wird.</li>
   <li>Wirft eine <span class="classname"><a href="class.mongodb-driver-exception-invalidargumentexception.php" class="classname">MongoDB\Driver\Exception\InvalidArgumentException</a></span>, wenn beim Analysieren von Argumenten ein Fehler auftritt.</li><li>Wirft eine <span class="classname"><a href="class.mongodb-driver-exception-connectionexception.php" class="classname">MongoDB\Driver\Exception\ConnectionException</a></span>, wenn der Aufbau einer Verbindung zum Server fehlschlägt (aus einem anderen Grund als der Authentifizierung).</li><li>Wirft eine <span class="classname"><a href="class.mongodb-driver-exception-authenticationexception.php" class="classname">MongoDB\Driver\Exception\AuthenticationException</a></span>, wenn eine Authentifizierung erforderlich ist und fehlschlägt.</li>
   <li>Throws <span class="classname"><a href="class.mongodb-driver-exception-runtimeexception.php" class="classname">MongoDB\Driver\Exception\RuntimeException</a></span> on other errors (e.g. invalid command).</li>
  </ul>
 </div>


 <div class="refsect1 changelog" id="refsect1-mongodb-driver-server.executewritecommand-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Beschreibung</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>PECL mongodb 1.4.4</td>
       <td>
        <span class="classname"><a href="class.mongodb-driver-exception-invalidargumentexception.php" class="classname">MongoDB\Driver\Exception\InvalidArgumentException</a></span>
        will be thrown if the <code class="literal">&quot;session&quot;</code> option is used in
        combination with an unacknowledged write concern.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-mongodb-driver-server.executewritecommand-notes">
  <h3 class="title">Anmerkungen</h3>
  
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <span class="simpara">
    Es liegt in der Verantwortung des aufrufenden Codes, sicherzustellen, dass
    der Server in der Lage ist, den Schreibvorgang auszuführen. So schlägt
    beispielsweise die Ausführung eines Schreibvorgangs auf einem sekundären
    Server (mit Ausnahme seiner &quot;lokalen&quot; Datenbank) fehl.
   </span>
  </p></blockquote>

 </div>


 <div class="refsect1 seealso" id="refsect1-mongodb-driver-server.executewritecommand-seealso">
  <h3 class="title">Siehe auch</h3>
  <ul class="simplelist">
   <li><span class="classname"><a href="class.mongodb-driver-command.php" class="classname">MongoDB\Driver\Command</a></span></li>
   <li><span class="classname"><a href="class.mongodb-driver-cursor.php" class="classname">MongoDB\Driver\Cursor</a></span></li>
   <li><span class="function"><a href="mongodb-driver-server.executecommand.php" class="function" rel="rdfs-seeAlso">MongoDB\Driver\Server::executeCommand()</a> - Execute a database command on this server</span></li>
   <li><span class="function"><a href="mongodb-driver-server.executereadcommand.php" class="function" rel="rdfs-seeAlso">MongoDB\Driver\Server::executeReadCommand()</a> - Execute a database command that reads on this server</span></li>
   <li><span class="function"><a href="mongodb-driver-server.executereadwritecommand.php" class="function" rel="rdfs-seeAlso">MongoDB\Driver\Server::executeReadWriteCommand()</a> - Execute a database command that reads and writes on this server</span></li>
   <li><span class="function"><a href="mongodb-driver-manager.executewritecommand.php" class="function" rel="rdfs-seeAlso">MongoDB\Driver\Manager::executeWriteCommand()</a> - Execute a database command that writes</span></li>
  </ul>
 </div>


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