Update docs for MongoCursor interator methods

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335444 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jeremy Mikola 2014-12-28 22:05:21 +00:00
parent eecf0808f0
commit 9eeba8cb28
10 changed files with 131 additions and 27 deletions

View file

@ -14,7 +14,7 @@
<void/>
</methodsynopsis>
<para>
This returns &null; until <function>MongoCommandCursor::next</function> is called.
This returns &null; until <function>MongoCommandCursor::rewind</function> is called.
</para>
</refsect1>
@ -26,9 +26,17 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The current result as an associative array.
The current result document as an associative array. &null; will be returned
if there is no result.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Iterator::current</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -4,13 +4,13 @@
<refentry xml:id="mongocommandcursor.key" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoCommandCursor::key</refname>
<refpurpose>Returns the current result&apos;s _id</refpurpose>
<refpurpose>Returns the current result&apos;s index within the result set</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>MongoCommandCursor::key</methodname>
<modifier>public</modifier> <type>int</type><methodname>MongoCommandCursor::key</methodname>
<void/>
</methodsynopsis>
</refsect1>
@ -21,11 +21,18 @@
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
&reftitle.returnvalues;
<para>
The current result&apos;s _id as a string.
The current result&apos;s index within the result set.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Iterator::key</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -21,7 +21,7 @@
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
&reftitle.returnvalues;
<para>
&null;.
</para>
@ -31,10 +31,17 @@
&reftitle.errors;
<para>
Throws <classname>MongoConnectionException</classname> if it cannot reach the
database and <classname>MongoCommandCursorTimeoutException</classname> if the
database and <classname>MongoCursorTimeoutException</classname> if the
timeout is exceeded.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Iterator::next</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -13,6 +13,9 @@
<modifier>public</modifier> <type>array</type><methodname>MongoCommandCursor::rewind</methodname>
<void/>
</methodsynopsis>
<para>
If the cursor has already started iteration, the command will be re-executed.
</para>
</refsect1>
<refsect1 role="parameters">
@ -21,11 +24,45 @@
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
&reftitle.returnvalues;
<para>
The raw server result document.
</para>
<screen>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Throws <classname>MongoConnectionException</classname> if it cannot reach the
database and <classname>MongoCursorTimeoutException</classname> if the
timeout is exceeded.
</para>
<para>
Throws <classname>MongoCursorException</classname> if the cursor was created
with <function>MongoCommandCursor::createFromDocument</function> and has
already started iteration. Such cursors cannot be iterated multiple times, as
they lack the original command necessary for re-execution.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>MongoCommandCursor::rewind</function></title>
<programlisting role="php">
<![CDATA[
<?php
$rawResult = $commandCursor->rewind();
// Command cursor is now reset to the start of the result set
var_dump($rawResult);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
array(2) {
["cursor"]=>
array(3) {
@ -53,16 +90,16 @@ array(2) {
["ok"]=>
float(1)
}
</screen>
]]>
</screen>
</example>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Throws <classname>MongoConnectionException</classname> if it cannot reach the
database and <classname>MongoCommandCursorTimeoutException</classname> if the
timeout is exceeded.
</para>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Iterator::rewind</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -4,7 +4,7 @@
<refentry xml:id="mongocommandcursor.valid" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoCommandCursor::valid</refname>
<refpurpose>Fetches a new result item, and returns whether it could</refpurpose>
<refpurpose>Checks if the cursor is reading a valid result.</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -21,11 +21,18 @@
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
&reftitle.returnvalues;
<para>
&true; if a next item could be returned, and &false; otherwise.
&true; if the current result is not null, and &false; otherwise.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Iterator::valid</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -26,9 +26,17 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The current result as an associative array.
The current result document as an associative array. &null; will be returned
if there is no result.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Iterator::current</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -4,13 +4,13 @@
<refentry xml:id="mongocursor.key" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoCursor::key</refname>
<refpurpose>Returns the current result&apos;s _id</refpurpose>
<refpurpose>Returns the current result&apos;s _id, or its index within the result set</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>MongoCursor::key</methodname>
<modifier>public</modifier> <type>string|int</type><methodname>MongoCursor::key</methodname>
<void/>
</methodsynopsis>
</refsect1>
@ -23,9 +23,18 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The current result&apos;s _id as a string.
The current result&apos;s <literal>_id</literal> as a string. If the result
has no <literal>_id</literal>, its numeric index within the result set will
be returned as an integer.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Iterator::key</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -35,6 +35,13 @@
timeout is exceeded.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Iterator::next</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -50,6 +50,13 @@ public function rewind() {
timeout is exceeded.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Iterator::rewind</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -21,11 +21,18 @@
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
&reftitle.returnvalues;
<para>
If the current result is not null.
&true; if the current result is not null, and &false; otherwise.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Iterator::valid</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables: