<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.mysql-xdevapi-collection.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'mysql-xdevapi-collection.remove.php',
    1 => 'Collection::remove',
    2 => 'Enl&egrave;ve des documents de la collection',
  ),
  'up' => 
  array (
    0 => 'class.mysql-xdevapi-collection.php',
    1 => 'mysql_xdevapi\\Collection',
  ),
  'prev' => 
  array (
    0 => 'mysql-xdevapi-collection.modify.php',
    1 => 'Collection::modify',
  ),
  'next' => 
  array (
    0 => 'mysql-xdevapi-collection.removeone.php',
    1 => 'Collection::removeOne',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/mysql_xdevapi/mysql_xdevapi/collection/remove.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mysql-xdevapi-collection.remove" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Collection::remove</h1>
  <p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">Collection::remove</span> &mdash; <span class="dc-title">Enlève des documents de la collection</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mysql-xdevapi-collection.remove-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>mysql_xdevapi\Collection::remove</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$search_condition</code></span>): <span class="type"><a href="class.mysql-xdevapi-collectionremove.php" class="type mysql_xdevapi\CollectionRemove">mysql_xdevapi\CollectionRemove</a></span></div>

  <p class="para rdfs-comment">
   Enlève des documents d&#039;une collection qui répondent à des conditions de recherche spécifiques.
   Plusieurs opérations sont autorisées, et la liaison de paramètres
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mysql-xdevapi-collection.remove-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <dl>
   
    <dt><code class="parameter">search_condition</code></dt>
    <dd>
     <p class="para">
      Doit être une expression SQL valide utilisée pour faire correspondre les documents à modifier.
      Cette expression peut être aussi simple que <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, qui correspond à tous les
      documents, ou elle peut utiliser des fonctions et des opérateurs tels que
      <code class="code">&#039;CAST(_id AS SIGNED) &gt;= 10&#039;</code>,
      <code class="code">&#039;age MOD 2 = 0 OR age MOD 3 = 0&#039;</code>, ou
      <code class="code">&#039;_id IN [&quot;2&quot;,&quot;5&quot;,&quot;7&quot;,&quot;10&quot;]&#039;</code>.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mysql-xdevapi-collection.remove-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Si l&#039;opération n&#039;est pas exécutée, alors la fonction retournera
   un objet Remove qui peut être utilisé pour ajouter des opérations
   de suppression supplémentaires.
  </p>
  <p class="para">
   Si l&#039;opération de suppression est exécutée, alors l&#039;objet retourné contiendra le
   résultat de l&#039;opération.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mysql-xdevapi-collection.remove-examples">
  <h3 class="title">Exemples</h3>
  <div class="example" id="example-1">
   <p><strong>Exemple #1 Exemple de <span class="function"><strong>mysql_xdevapi\Collection::remove()</strong></span></strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$session </span><span style="color: #007700">= </span><span style="color: #0000BB">mysql_xdevapi\getSession</span><span style="color: #007700">(</span><span style="color: #DD0000">"mysqlx://user:password@localhost"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$session</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sql</span><span style="color: #007700">(</span><span style="color: #DD0000">"DROP DATABASE IF EXISTS addressbook"</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$session</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sql</span><span style="color: #007700">(</span><span style="color: #DD0000">"CREATE DATABASE addressbook"</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$schema     </span><span style="color: #007700">= </span><span style="color: #0000BB">$session</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getSchema</span><span style="color: #007700">(</span><span style="color: #DD0000">"addressbook"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$collection </span><span style="color: #007700">= </span><span style="color: #0000BB">$schema</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createCollection</span><span style="color: #007700">(</span><span style="color: #DD0000">"people"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add</span><span style="color: #007700">(</span><span style="color: #DD0000">'{"name": "Alfred", "age": 18, "job": "Butler"}'</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$collection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add</span><span style="color: #007700">(</span><span style="color: #DD0000">'{"name": "Bob",    "age": 19, "job": "Painter"}'</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">// Enlève tous les painters<br /></span><span style="color: #0000BB">$collection<br />  </span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">remove</span><span style="color: #007700">(</span><span style="color: #DD0000">"job in ('Painter')"</span><span style="color: #007700">)<br />  -&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">// Enlève le plus vieux butler<br /></span><span style="color: #0000BB">$collection<br />  </span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">remove</span><span style="color: #007700">(</span><span style="color: #DD0000">"job in ('Butler')"</span><span style="color: #007700">)<br />  -&gt;</span><span style="color: #0000BB">sort</span><span style="color: #007700">(</span><span style="color: #DD0000">'age desc'</span><span style="color: #007700">)<br />  -&gt;</span><span style="color: #0000BB">limit</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">)<br />  -&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">// Enlève le record avec l'âge le plus élevé<br /></span><span style="color: #0000BB">$collection<br />  </span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">remove</span><span style="color: #007700">(</span><span style="color: #DD0000">'true'</span><span style="color: #007700">)<br />  -&gt;</span><span style="color: #0000BB">sort</span><span style="color: #007700">(</span><span style="color: #DD0000">'age desc'</span><span style="color: #007700">)<br />  -&gt;</span><span style="color: #0000BB">limit</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">)<br />  -&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


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