mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-27 14:28:56 +00:00

See https://github.com/phpdocbrbridge/bridge/blob/master/src/revbumper.php for automatic tool for translations. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@342988 c90b9560-bf6c-de11-be94-00142212c4b1
132 lines
4.1 KiB
XML
132 lines
4.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- $Revision$ -->
|
|
<phpdoc:classref xml:id="class.mongocommandcursor" 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 MongoCommandCursor class</title>
|
|
<titleabbrev>MongoCommandCursor</titleabbrev>
|
|
|
|
<partintro>
|
|
|
|
<!-- {{{ MongocommandCursor intro -->
|
|
<section xml:id="mongocommandcursor.intro">
|
|
&reftitle.intro;
|
|
<para>
|
|
A command cursor is similar to a <classname>MongoCursor</classname> except
|
|
that you use it for iterating through the results of a database command
|
|
instead of a normal query. Command cursors are useful for iterating over
|
|
large result sets that might exceed the document size limit (currently 16MB)
|
|
of a single <function>MongoDB::command</function> response.
|
|
</para>
|
|
<para>
|
|
While you can create command cursors using
|
|
<function>MongoCommandCursor::__construct</function> or the
|
|
<function>MongoCommandCursor::createFromDocument</function> factory method,
|
|
you will generally want to use command-specific helpers such as
|
|
<function>MongoCollection::aggregateCursor</function>.
|
|
</para>
|
|
<para>
|
|
Note that the cursor does not "contain" the database command's results; it
|
|
just manages iteration through them. Thus, if you print a cursor (f.e. with
|
|
<function>var_dump</function> or <function>print_r</function>), you will see
|
|
the cursor object but not the result documents.
|
|
</para>
|
|
</section>
|
|
|
|
<section>
|
|
<title>Cursor Stages</title>
|
|
<para>
|
|
A <classname>MongoCommandCursor</classname> has two "life stages": pre-
|
|
and post- command. When a cursor is created, it has not yet contacted the
|
|
database, so it is in its pre-command state. When the client first attempts
|
|
to get a result (by calling <function>MongoCommandCursor::rewind</function>,
|
|
directly or indirectly), the cursor moves into the post-command state.
|
|
</para>
|
|
<para>
|
|
The command cursor's batch size and socket timeout may be configured in both
|
|
the pre- and post- command states.
|
|
</para>
|
|
<para>
|
|
<example xml:id="mongocommandcursor.stages.adding-options">
|
|
<title>Adding options to <classname>MongoCommandCursor</classname></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$cursor = new MongoCommandCursor(...);
|
|
|
|
$cursor = $cursor->batchSize( 4 );
|
|
|
|
foreach ($cursor as $result) {
|
|
var_dump($result);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</section>
|
|
<!-- }}} -->
|
|
|
|
<section xml:id="mongocommandcursor.synopsis">
|
|
&reftitle.classsynopsis;
|
|
|
|
<!-- {{{ Synopsis -->
|
|
<classsynopsis>
|
|
<ooclass><classname>MongoCommandCursor</classname></ooclass>
|
|
|
|
<!-- {{{ Class synopsis -->
|
|
<classsynopsisinfo>
|
|
<ooclass>
|
|
<classname>MongoCommandCursor</classname>
|
|
</ooclass>
|
|
<oointerface>
|
|
<interfacename>MongoCursorInterface</interfacename>
|
|
</oointerface>
|
|
<oointerface>
|
|
<interfacename>Iterator</interfacename>
|
|
</oointerface>
|
|
</classsynopsisinfo>
|
|
<!-- }}} -->
|
|
|
|
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongocommandcursor')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
|
|
</classsynopsis>
|
|
<!-- }}} -->
|
|
|
|
</section>
|
|
|
|
<section role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><methodname>MongoDB::command</methodname></member>
|
|
<member><methodname>MongoCollection::aggregateCursor</methodname></member>
|
|
</simplelist>
|
|
</section>
|
|
|
|
</partintro>
|
|
|
|
&reference.mongo.entities.mongocommandcursor;
|
|
|
|
</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
|
|
-->
|