mirror of
https://github.com/php/doc-ru.git
synced 2025-08-20 23:31:15 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@347222 c90b9560-bf6c-de11-be94-00142212c4b1
143 lines
4.3 KiB
XML
143 lines
4.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 0207f79751057862d135eddc1bc4c12278a62795 Maintainer: sergey Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<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>Создает новый командный курсор</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>
|
|
Как правило, вам не нужно создавать <classname>MongoCommandCursor</classname> вручную,
|
|
поскольку существуют вспомогательные функции, такие как <methodname>MongoCollection::aggregateCursor</methodname>
|
|
и <methodname>MongoCollection::parallelCollectionScan</methodname>;
|
|
однако, если сервер вводит новые команды, которые могут возвращать курсоры,
|
|
этот конструктор будет полезен при отсутствии определенных вспомогательных методов.
|
|
Вы также можете рассмотреть возможность использования <methodname>MongoCommandCursor::createFromDocument</methodname>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>connection</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Подключение к базе данных.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>ns</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Полное имя базы данных и коллекции
|
|
(например, <literal>"test.foo"</literal>)
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>command</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Команда базы данных.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Возвращает новый курсор.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title>Пример использования <classname>MongoCommandCursor</classname></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$m = new MongoClient;
|
|
|
|
// Определяет конвейер агрегации
|
|
$pipeline = [
|
|
[ '$group' => [
|
|
'_id' => '$country_code',
|
|
'timezones' => [ '$addToSet' => '$timezone' ]
|
|
] ],
|
|
[ '$sort' => [ '_id' => 1 ] ],
|
|
];
|
|
|
|
// Создает объект MongoCommandCursor
|
|
$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
|
|
-->
|