<?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-cursor.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'mongodb-driver-cursor.isdead.php',
    1 => 'MongoDB\\Driver\\Cursor::isDead',
    2 => 'Checks if the cursor is exhausted or may have additional results',
  ),
  'up' => 
  array (
    0 => 'class.mongodb-driver-cursor.php',
    1 => 'MongoDB\\Driver\\Cursor',
  ),
  'prev' => 
  array (
    0 => 'mongodb-driver-cursor.getserver.php',
    1 => 'MongoDB\\Driver\\Cursor::getServer',
  ),
  'next' => 
  array (
    0 => 'mongodb-driver-cursor.key.php',
    1 => 'MongoDB\\Driver\\Cursor::key',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mongodb/mongodb/driver/cursor/isdead.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mongodb-driver-cursor.isdead" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\Driver\Cursor::isDead</h1>
  <p class="verinfo">(mongodb &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">MongoDB\Driver\Cursor::isDead</span> &mdash; <span class="dc-title">Checks if the cursor is exhausted or may have additional results</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongodb-driver-cursor.isdead-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><strong>MongoDB\Driver\Cursor::isDead</strong></span>(): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="simpara">
   Checks whether there are definitely no additional results available on the
   cursor. This method is similar to the
   <a href="https://www.mongodb.com/docs/manual/reference/method/cursor.isExhausted/" class="link external">&raquo;&nbsp;cursor.isExhausted()</a>
   method in the MongoDB shell and is primarily useful when iterating
   <a href="https://www.mongodb.com/docs/manual/core/tailable-cursors/" class="link external">&raquo;&nbsp;tailable cursors</a>.
  </p>
  <p class="para">
   A cursor has no additional results and is considered &quot;dead&quot; when one of the
   following is true:
   <ul class="simplelist">
    <li>
     The current batch has been fully iterated <em>and</em> the
     cursor ID is zero (i.e. a
     <a href="https://www.mongodb.com/docs/manual/reference/command/getMore/" class="link external">&raquo;&nbsp;getMore</a>
     cannot be issued).
    </li>
    <li>An error was encountered while iterating the cursor.</li>
    <li>The cursor reached its configured limit.</li>
   </ul>
  </p>
  <p class="para">
   By design, it is not possible to always determine whether a cursor has
   additional results. The cases where a cursor <em>may</em> have
   more data available is as follows:
   <ul class="simplelist">
    <li>
     There are additional documents in the current batch, which are buffered on
     the client side. Iterating will fetch a document from the local buffer.
    </li>
    <li>
     There are no additional documents in the current batch (i.e. local buffer),
     but the cursor ID is non-zero. Iterating will request more documents from
     the server via a
     <a href="https://www.mongodb.com/docs/manual/reference/command/getMore/" class="link external">&raquo;&nbsp;getMore</a>
     operation, which may or may not return additional results and/or indicate
     that the cursor has been closed on the server by returning zero for its ID.
    </li>
   </ul>
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongodb-driver-cursor.isdead-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">この関数にはパラメータはありません。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongodb-driver-cursor.isdead-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="simpara">
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> if there are definitely no additional results available on the
   cursor, and <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> otherwise.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongodb-driver-cursor.isdead-errors">
  <h3 class="title">エラー / 例外</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-cursor.isdead-examples">
  <h3 class="title">例</h3>
  <div class="example" id="example-1">
   <p><strong>例1 <span class="function"><strong>MongoDB\Driver\Cursor::isDead()</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">(</span><span style="color: #DD0000">"mongodb://localhost:27017"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$query </span><span style="color: #007700">= new </span><span style="color: #0000BB">MongoDB\Driver\Query</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\BulkWrite</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$bulk</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</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">]);<br /></span><span style="color: #0000BB">$bulk</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">([</span><span style="color: #DD0000">'x' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">2</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB">$bulk</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">([</span><span style="color: #DD0000">'x' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">3</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB">$manager</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">executeBulkWrite</span><span style="color: #007700">(</span><span style="color: #DD0000">'db.collection'</span><span style="color: #007700">, </span><span style="color: #0000BB">$bulk</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$cursor </span><span style="color: #007700">= </span><span style="color: #0000BB">$manager</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">executeQuery</span><span style="color: #007700">(</span><span style="color: #DD0000">'db.collection'</span><span style="color: #007700">, </span><span style="color: #0000BB">$query</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$iterator </span><span style="color: #007700">= new </span><span style="color: #0000BB">IteratorIterator</span><span style="color: #007700">(</span><span style="color: #0000BB">$cursor</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$iterator</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">rewind</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cursor</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">isDead</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">$iterator</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">next</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cursor</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">isDead</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">$iterator</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">next</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cursor</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">isDead</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">$iterator</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">next</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cursor</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">isDead</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>上の例の出力は以下となります。</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">bool(false)
bool(false)
bool(false)
bool(true)</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongodb-driver-cursor.isdead-seealso">
  <h3 class="title">参考</h3>
  <ul class="simplelist">
   <li><a href="https://www.mongodb.com/docs/manual/core/tailable-cursors/" class="link external">&raquo;&nbsp;Tailable Cursors</a> in the MongoDB manual</li>
   <li><a href="https://www.mongodb.com/docs/manual/reference/method/cursor.isExhausted/" class="link external">&raquo;&nbsp;cursor.isExhausted()</a> in the MongoDB manual</li>
  </ul>
 </div>


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