<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Gets the query, fields, limit, and skip for this cursor</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mongocursor.immortal.html">MongoCursor::immortal</a></div> <div class="next" style="text-align: right; float: right;"><a href="mongocursor.key.html">MongoCursor::key</a></div> <div class="up"><a href="class.mongocursor.html">MongoCursor</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="mongocursor.info" class="refentry"> <div class="refnamediv"> <h1 class="refname">MongoCursor::info</h1> <p class="verinfo">(PECL mongo >=1.0.5)</p><p class="refpurpose"><span class="refname">MongoCursor::info</span> — <span class="dc-title">Gets the query, fields, limit, and skip for this cursor</span></p> </div> <div class="refsect1 description" id="refsect1-mongocursor.info-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><strong>MongoCursor::info</strong></span> ( <span class="methodparam">void</span> )</div> <p class="para rdfs-comment"> This can be called before or after the query. </p> </div> <div class="refsect1 parameters" id="refsect1-mongocursor.info-parameters"> <h3 class="title">Parameters</h3> <p class="para">This function has no parameters.</p> </div> <div class="refsect1 returnvalues" id="refsect1-mongocursor.info-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the namespace, limit, skip, query, and fields for this cursor. </p> </div> <div class="refsect1 changelog" id="refsect1-mongocursor.info-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>1.1.0</td> <td> Added a number of other fields, including <em>id</em> (the cursor id), <em>at</em> (the driver's counter of which document is current), <em>numReturned</em> (the number returned by the server in the current batch), and <em>server</em> (which server the query was sent to—useful in conjunction with <a href="mongo.readpreferences.html" class="xref">Read Preferences</a>. </td> </tr> <tr> <td>1.0.10</td> <td> Added <em>started_iterating</em> field, a boolean indicating if cursor is pre- or post-query. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 examples" id="refsect1-mongocursor.info-examples"> <h3 class="title">Examples</h3> <div class="example" id="example-1482"> <p><strong>Example #1 <span class="function"><strong>MongoCursor::info()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br />$m </span><span style="color: #007700">= new </span><span style="color: #0000BB">MongoClient</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$cursor </span><span style="color: #007700">= </span><span style="color: #0000BB">$m</span><span style="color: #007700">-></span><span style="color: #0000BB">foo</span><span style="color: #007700">-></span><span style="color: #0000BB">bar</span><span style="color: #007700">-></span><span style="color: #0000BB">find</span><span style="color: #007700">(array(</span><span style="color: #DD0000">"x" </span><span style="color: #007700">=> </span><span style="color: #0000BB">4</span><span style="color: #007700">), array(</span><span style="color: #DD0000">"y" </span><span style="color: #007700">=> </span><span style="color: #0000BB">false</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">-></span><span style="color: #0000BB">info</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output something similar to:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> array(5) { ["ns"]=> string(7) "foo.bar" ["limit"]=> int(0) ["skip"]=> int(0) ["query"]=> array(1) { ["x"]=> int(4) } ["fields"]=> array(1) { ["y"]=> int(0) } } </pre></div> </div> </div> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mongocursor.immortal.html">MongoCursor::immortal</a></div> <div class="next" style="text-align: right; float: right;"><a href="mongocursor.key.html">MongoCursor::key</a></div> <div class="up"><a href="class.mongocursor.html">MongoCursor</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>