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

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@281555 c90b9560-bf6c-de11-be94-00142212c4b1
102 lines
2.4 KiB
XML
102 lines
2.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- $Revision: 1.2 $ -->
|
|
<refentry xml:id="mongocollection.count" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>MongoCollection::count</refname>
|
|
<refpurpose>Counts the number of documents in this collection</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<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>array</type><parameter>fields</parameter><initializer>array()</initializer></methodparam>
|
|
</methodsynopsis>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>query</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Only count documents matching this query.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>fields</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Only count documents with these fields.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns the number of documents.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title><function>MongoCollection::count</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$collection->insert(array('x'=>1));
|
|
$collection->insert(array('x'=>2));
|
|
$collection->insert(array('x'=>3, 'y'=>1));
|
|
|
|
var_dump($collection->count());
|
|
var_dump($collection->count(array('x'=>1)));
|
|
var_dump($collection->count(array(), array('z'=>1)));
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
float(3)
|
|
float(1)
|
|
float(0)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</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:"../../../../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
|
|
-->
|