Documentation for MongoCursorInterface

This interface extends Iterator and is implemented internally by MongoCursor and MongoCommandCursor. In addition to the interface methods, "see also" links were added on the implemented methods to point back to the interface documentation (as we did for Iterator methods).

https://jira.mongodb.org/browse/PHP-1328


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335760 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jeremy Mikola 2015-01-15 21:10:35 +00:00
parent a2b30c956f
commit 9f0e1e36a3
22 changed files with 520 additions and 3 deletions

View file

@ -96,7 +96,7 @@
Following is a list of all improvements to existing methods since
their inception.
</para>
<?phpdoc generate-changelog-for="mongo.batch mongo.connecting mongo.context mongo.core mongo.exceptions mongo.gridfs mongo.manual mongo.manual.intro mongo.miscellaneous class.mongo class.mongobindata class.mongoclient class.mongocode class.mongocollection class.mongocommandcursor class.mongoconnectionexception class.mongocursor class.mongocursorexception class.mongocursortimeoutexception class.mongodate class.mongodb class.mongodbref class.mongodeletebatch class.mongoduplicatekeyexception class.mongoexception class.mongoexecutiontimeoutexception class.mongogridfs class.mongogridfscursor class.mongogridfsexception class.mongogridfsfile class.mongoid class.mongoinsertbatch class.mongoint32 class.mongoint64 class.mongolog class.mongomaxkey class.mongominkey class.mongopool class.mongoprotocolexception class.mongoregex class.mongoresultexception class.mongotimestamp class.mongoupdatebatch class.mongowritebatch class.mongowriteconcernexception mongo.queries mongo.readpreferences ref.mongo mongo.security mongo.setup mongo.sqltomongo mongo.testing mongo.trouble mongo.tutorial mongo.types mongo.updates mongo.writeconcerns mongo.writes" ?>
<?phpdoc generate-changelog-for="mongo.batch mongo.connecting mongo.context mongo.core mongo.exceptions mongo.gridfs mongo.manual mongo.manual.intro mongo.miscellaneous class.mongo class.mongobindata class.mongoclient class.mongocode class.mongocollection class.mongocommandcursor class.mongoconnectionexception class.mongocursor class.mongocursorinterface class.mongocursorexception class.mongocursortimeoutexception class.mongodate class.mongodb class.mongodbref class.mongodeletebatch class.mongoduplicatekeyexception class.mongoexception class.mongoexecutiontimeoutexception class.mongogridfs class.mongogridfscursor class.mongogridfsexception class.mongogridfsfile class.mongoid class.mongoinsertbatch class.mongoint32 class.mongoint64 class.mongolog class.mongomaxkey class.mongominkey class.mongopool class.mongoprotocolexception class.mongoregex class.mongoresultexception class.mongotimestamp class.mongoupdatebatch class.mongowritebatch class.mongowriteconcernexception mongo.queries mongo.readpreferences ref.mongo mongo.security mongo.setup mongo.sqltomongo mongo.testing mongo.trouble mongo.tutorial mongo.types mongo.updates mongo.writeconcerns mongo.writes" ?>
</simplesect>

View file

@ -14,6 +14,7 @@
&reference.mongo.mongodb;
&reference.mongo.mongocollection;
&reference.mongo.mongocursor;
&reference.mongo.mongocursorinterface;
&reference.mongo.mongocommandcursor;
</part>

View file

@ -81,10 +81,10 @@ foreach ($cursor as $result) {
<classname>MongoCommandCursor</classname>
</ooclass>
<oointerface>
<interfacename>Iterator</interfacename>
<interfacename>MongoCursorInterface</interfacename>
</oointerface>
<oointerface>
<interfacename>MongoCursorInterface</interfacename>
<interfacename>Iterator</interfacename>
</oointerface>
</classsynopsisinfo>
<!-- }}} -->

View file

@ -65,6 +65,12 @@ $commandCursor->batchSize(20);
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>MongoCursorInterface::batchSize</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -33,6 +33,13 @@
client, and &false; otherwise.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>MongoCursorInterface::dead</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -170,6 +170,12 @@ array(17) {
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>MongoCursorInterface::info</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -103,6 +103,7 @@ foreach ( $cursor as $result ) {
&reftitle.seealso;
<simplelist>
<member><function>MongoCollection::aggregateCursor</function></member>
<member><methodname>MongoCursorInterface::timeout</methodname></member>
<member>The <literal>socketTimeoutMS</literal> option for <function>MongoClient::__construct</function></member>
</simplelist>
</refsect1>

View file

@ -122,6 +122,9 @@ $cursor->skip(4);
<ooclass>
<classname>MongoCursor</classname>
</ooclass>
<oointerface>
<interfacename>MongoCursorInterface</interfacename>
</oointerface>
<oointerface>
<interfacename>Iterator</interfacename>
</oointerface>

View file

@ -131,6 +131,7 @@ $cursor->limit(30)->batchSize(7)
<para>
<simplelist>
<member><function>MongoCursor::limit</function></member>
<member><methodname>MongoCursorInterface::batchSize</methodname></member>
</simplelist>
</para>
</refsect1>

View file

@ -39,6 +39,13 @@
client, and &false; otherwise.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>MongoCursorInterface::dead</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -79,6 +79,7 @@ array(2) {
<simplelist>
<member>The <link linkend="mongo.readpreferences">read preferences</link> documentation.</member>
<member><function>MongoCursor::setReadPreference</function></member>
<member><function>MongoCursorInterface::getReadPreference</function></member>
</simplelist>
</refsect1>

View file

@ -163,6 +163,12 @@ array(15) {
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>MongoCursorInterface::info</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -62,6 +62,7 @@ $cursor->setReadPreference(MongoClient::RP_NEAREST, array(
<simplelist>
<member>The <link linkend="mongo.readpreferences">read preferences</link> documentation.</member>
<member><function>MongoCursor::getReadPreference</function></member>
<member><function>MongoCursorInterface::setReadPreference</function></member>
</simplelist>
</refsect1>

View file

@ -106,6 +106,7 @@ while ($cursor->hasNext()) {
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>MongoCursorInterface::timeout</methodname></member>
<member>The <literal>socketTimeoutMS</literal> option for <function>MongoClient::__construct</function></member>
</simplelist>
</refsect1>

View file

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 335348 $ -->
<phpdoc:classref xml:id="class.mongocursorinterface" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The MongoCursorInterface interface</title>
<titleabbrev>MongoCursorInterface</titleabbrev>
<partintro>
<!-- {{{ mongocursorinterface intro -->
<section xml:id="mongocursorinterface.intro">
&reftitle.intro;
<para>
Interface for cursors, which can be used to iterate through results of a
database query or command. This interface is implemented by the
<classname>MongoCursor</classname> and
<classname>MongoCommandCursor</classname> classes.
</para>
<note>
<simpara>
Similar to <classname>Traversable</classname>, this interface cannot be
implemented in PHP scripts.
</simpara>
</note>
</section>
<!-- }}} -->
<section xml:id="mongocursorinterface.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>MongoCursorInterface</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>MongoCursorInterface</classname>
</ooclass>
<ooclass>
<modifier>extends</modifier>
<classname>Iterator</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongocursorinterface')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.iterator')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.mongo.entities.mongocursorinterface;
</phpdoc:classref>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 335345 $ -->
<refentry xml:id="mongocursorinterface.batchsize" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoCursorInterface::batchSize</refname>
<refpurpose>Limits the number of elements returned in one batch.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>abstract</modifier> <modifier>public</modifier> <type>MongoCursorInterface</type><methodname>MongoCursorInterface::batchSize</methodname>
<methodparam><type>int</type><parameter>batchSize</parameter></methodparam>
</methodsynopsis>
<para>
A cursor typically fetches a batch of result objects and stores them
locally. This method sets the batch size value to configure the amount of
documents retrieved from the server in one round trip.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term>
<parameter>batchSize</parameter>
</term>
<listitem>
<para>
The number of results to return per batch.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns this cursor.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 335441 $ -->
<refentry xml:id="mongocursorinterface.dead" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoCursorInterface::dead</refname>
<refpurpose>Checks if there are results that have not yet been sent from the database</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>abstract</modifier> <modifier>public</modifier> <type>bool</type><methodname>MongoCursorInterface::dead</methodname>
<void/>
</methodsynopsis>
<para>
This method checks whether the cursor has been exhausted and the database has
no more results to send to the client. A cursor being "dead" does not
necessarily mean that there are no more results available for iteration.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if there are more results that have not yet been sent to the
client, and &false; otherwise.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 332955 $ -->
<refentry xml:id="mongocursorinterface.getreadpreference" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoCursorInterface::getReadPreference</refname>
<refpurpose>Get the read preference for this query</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>abstract</modifier> <modifier>public</modifier> <type>array</type><methodname>MongoCursorInterface::getReadPreference</methodname>
<void/>
</methodsynopsis>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
&mongo.getreadpreference.returnvalues;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member>The <link linkend="mongo.readpreferences">read preferences</link> documentation.</member>
<member><function>MongoCursorInterface::setReadPreference</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 335440 $ -->
<refentry xml:id="mongocursorinterface.info" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoCursorInterface::info</refname>
<refpurpose>Gets information about the cursor's creation and iteration</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>abstract</modifier> <modifier>public</modifier> <type>array</type><methodname>MongoCursorInterface::info</methodname>
<void/>
</methodsynopsis>
<para>
Returns information about the cursor's creation and iteration. This can be
called before or after the cursor has started iterating.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the namespace, batch size, limit, skip, flags, query, and projected
fields for this cursor. If the cursor has started iterating, additional
information about iteration and the connection will be included.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 332955 $ -->
<refentry xml:id="mongocursorinterface.setreadpreference" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoCursorInterface::setReadPreference</refname>
<refpurpose>Set the read preference for this query</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>abstract</modifier> <modifier>public</modifier> <type>MongoCursorInterface</type><methodname>MongoCursorInterface::setReadPreference</methodname>
<methodparam><type>string</type><parameter>read_preference</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>tags</parameter></methodparam>
</methodsynopsis>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&mongo.setreadpreference.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns this cursor.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&mongo.setreadpreference.errors;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member>The <link linkend="mongo.readpreferences">read preferences</link> documentation.</member>
<member><function>MongoCursorInterface::getReadPreference</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 335443 $ -->
<refentry xml:id="mongocursorinterface.timeout" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoCursorInterface::timeout</refname>
<refpurpose>Sets a client-side timeout for this query</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>abstract</modifier> <modifier>public</modifier> <type>MongoCursorInterface</type><methodname>MongoCursorInterface::timeout</methodname>
<methodparam><type>int</type><parameter>ms</parameter></methodparam>
</methodsynopsis>
<para>
A timeout can be set at any time and will affect subsequent data retrieval
associated with this cursor, including fetching more results from the
database.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term>
<parameter>ms</parameter>
</term>
<listitem>
<para>
The number of milliseconds for the cursor to wait for a response. Use
<literal>-1</literal> to wait forever. By default, the cursor will wait
<varname>30000</varname> milliseconds (30 seconds).
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns this cursor.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Causes methods that fetch results to throw a
<classname>MongoCursorTimeoutException</classname> if the data fetch takes
longer than the specified number of milliseconds.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member>The <literal>socketTimeoutMS</literal> option for <function>MongoClient::__construct</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -143,6 +143,15 @@
<function name='mongocursor::timeout' from='PECL mongo &gt;=1.0.3'/>
<function name='mongocursor::valid' from='PECL mongo &gt;=0.9.0'/>
<!-- }}} -->
<!-- {{{ MongoCursorInterface -->
<function name='mongocursorinterface' from='PECL mongo &gt;=1.5.0'/>
<function name='mongocursorinterface::batchSize' from='PECL mongo &gt;=1.5.0'/>
<function name='mongocursorinterface::dead' from='PECL mongo &gt;=1.5.0'/>
<function name='mongocursorinterface::getreadpreference' from='PECL mongo &gt;=1.6.0'/>
<function name='mongocursorinterface::info' from='PECL mongo &gt;=1.5.0'/>
<function name='mongocursorinterface::setreadpreference' from='PECL mongo &gt;=1.6.0'/>
<function name='mongocursorinterface::timeout' from='PECL mongo &gt;=1.5.0'/>
<!-- }}} -->
<!-- {{{ MongoCommandCursor -->
<function name='mongocommandcursor' from='PECL mongo &gt;=1.5.0'/>
<function name='mongocommandcursor::__construct' from='PECL mongo &gt;=1.5.0'/>