mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-22 20:08:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335866 c90b9560-bf6c-de11-be94-00142212c4b1
142 lines
3.7 KiB
XML
142 lines
3.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="mongocommandcursor.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>MongoCommandCursor::__construct</refname>
|
|
<refpurpose>Create a new command cursor</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <methodname>MongoCommandCursor::__construct</methodname>
|
|
<methodparam><type>MongoClient</type><parameter>connection</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>ns</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>command</parameter><initializer>array()</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Generally, you should not have to construct a
|
|
<classname>MongoCommandCursor</classname> manually, as there are helper
|
|
functions such as <methodname>MongoCollection::aggregateCursor</methodname>
|
|
and <methodname>MongoCollection::parallelCollectionScan</methodname>;
|
|
however, if the server introduces new commands that can return cursors, this
|
|
constructor will be useful in the absence of specific helper methods. You may
|
|
also consider using
|
|
<methodname>MongoCommandCursor::createFromDocument</methodname>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>connection</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Database connection.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>ns</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Full name of the database and collection (e.g.
|
|
<literal>"test.foo"</literal>)
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>command</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Database command.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns the new cursor.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title><classname>MongoCommandCursor</classname> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$m = new MongoClient;
|
|
|
|
// Define the aggregation pipeline
|
|
$pipeline = [
|
|
[ '$group' => [
|
|
'_id' => '$country_code',
|
|
'timezones' => [ '$addToSet' => '$timezone' ]
|
|
] ],
|
|
[ '$sort' => [ '_id' => 1 ] ],
|
|
];
|
|
|
|
// Construct a MongoCommandCursor object
|
|
$cursor = new MongoCommandCursor(
|
|
$m, // MongoClient object
|
|
'demo.cities', // namespace
|
|
[
|
|
'aggregate' => 'cities',
|
|
'pipeline' => $pipeline,
|
|
'cursor' => [ 'batchSize' => 0 ],
|
|
]
|
|
);
|
|
|
|
foreach($cursor as $result) {
|
|
…
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><function>MongoCommandCursor::createFromDocument</function></member>
|
|
<member><function>MongoCollection::aggregateCursor</function></member>
|
|
<member><function>MongoCollection::parallelCollectionScan</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
|
|
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
|
|
-->
|