<?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 => 'ja',
  ),
  'this' => 
  array (
    0 => 'mysql-xdevapi-collection.remove.php',
    1 => 'Collection::remove',
    2 => 'コレクションを削除する',
  ),
  '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' => 'ja',
    '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">コレクションを削除する</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mysql-xdevapi-collection.remove-description">
  <h3 class="title">説明</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">
   特定の検索条件に合致するドキュメントのコレクションを削除します。
   複数の操作が可能で、パラメータのバインドもサポートしています。
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-mysql-xdevapi-collection.remove-parameters">
  <h3 class="title">パラメータ</h3>
  <dl>
   
    <dt><code class="parameter">search_condition</code></dt>
    <dd>
     <p class="para">
      削除するドキュメントに
      マッチさせるために使う、有効な MySQL の式でなければなりません。
      この式は、<strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> と評価される単純なものであれば可能です。
      <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> と評価された全てのドキュメントにマッチします。
      もしくは、関数と指揮を次のように使うこともできます。
      <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>, 
      <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">戻り値</h3>
  <p class="para">
   操作が実行されない場合、この関数は追加の削除操作を追加できる
   Remove オブジェクトを返します。
  </p>
  <p class="para">
   削除操作が実行された場合、返されるオブジェクトには操作結果が含まれます。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mysql-xdevapi-collection.remove-examples">
  <h3 class="title">例</h3>
  <div class="example" id="example-1">
   <p><strong>例1 <span class="function"><strong>mysql_xdevapi\Collection::remove()</strong></span> example</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">// 全ての Painter を削除<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">// もっとも古い Bulter を削除<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">// age が一番高いレコードを削除<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); ?>