MongoCollection::count() now takes an $options array

https://jira.mongodb.org/browse/PHP-1160
https://jira.mongodb.org/browse/PHP-1263


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335161 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jeremy Mikola 2014-11-05 21:15:09 +00:00
parent b653253e42
commit dbdc52230d

View file

@ -12,8 +12,7 @@
<methodsynopsis>
<modifier>public</modifier> <type>int</type><methodname>MongoCollection::count</methodname>
<methodparam choice="opt"><type>array</type><parameter>query</parameter><initializer>array()</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>limit</parameter><initializer>0</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>skip</parameter><initializer>0</initializer></methodparam>
<methodparam choice="opt"><type>array</type><parameter>options</parameter><initializer>array()</initializer></methodparam>
</methodsynopsis>
</refsect1>
@ -30,27 +29,69 @@
Associative array or object with fields to match.
</para>
</listitem>
</varlistentry>
</varlistentry>
<varlistentry>
<term>
<parameter>limit</parameter>
<parameter>options</parameter>
</term>
<listitem>
<para>
Specifies an upper limit to the number returned.
An array of options for the index creation. Currently available options
include:
<informaltable>
<tgroup cols="3">
<thead>
<row>
<entry>&Name;</entry>
<entry>&Type;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry><varname>hint</varname></entry>
<entry><type>mixed</type></entry>
<entry>
<para>
Index to use for the query. If a string is passed, it should
correspond to an index name. If an array or object is passed, it
should correspond to the specification used to create the index
(i.e. the first argument to
<function>MongoCollection::createIndex</function>).
</para>
<simpara>This option is only supported in MongoDB 2.6+.</simpara>
</entry>
</row>
<row>
<entry><varname>limit</varname></entry>
<entry><type>integer</type></entry>
<entry>The maximum number of matching documents to return.</entry>
</row>
<row>
<entry><varname>maxTimeMS</varname></entry>
<entry><type>integer</type></entry>
<entry>
<para>
Specifies a cumulative time limit in milliseconds for processing
the operation (does not include idle time). If the operation is not
completed within the timeout period, a
<classname>MongoExecutionTimeoutException</classname> will be
thrown.
</para>
<simpara>This option is only supported in MongoDB 2.6+.</simpara>
</entry>
</row>
<row>
<entry><varname>skip</varname></entry>
<entry><type>integer</type></entry>
<entry>The number of matching documents to skip before returning results.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>skip</parameter>
</term>
<listitem>
<para>
Specifies a number of results to skip before starting the count.
</para>
</listitem>
</varlistentry>
</varlistentry>
</variablelist>
</para>
</refsect1>
@ -62,6 +103,18 @@
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Throws <classname>MongoResultException</classname> if the server could not
execute the command due to an error.
</para>
<para>
Throws <classname>MongoExecutionTimeoutException</classname> if command
execution was terminated due to <varname>maxTimeMS</varname>.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
@ -74,11 +127,19 @@
</row>
</thead>
<tbody>
<row>
<entry>1.6.0</entry>
<entry>
The second parameter is now an <parameter>options</parameter> array.
Passing <parameter>limit</parameter> and <parameter>skip</parameter> as
the second and third parameters, respectively, is deprecated.
</entry>
</row>
<row>
<entry>1.0.7</entry>
<entry>
Added <parameter>limit</parameter> and <parameter>skip</parameter>
parameters.
Added <parameter>limit</parameter> and <parameter>skip</parameter> as
second and third parameters, respectively.
</entry>
</row>
</tbody>