mirror of
https://github.com/php/doc-es.git
synced 2026-03-26 00:12:06 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@337046 c90b9560-bf6c-de11-be94-00142212c4b1
200 lines
5.8 KiB
XML
200 lines
5.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: dbdc52230de818978a15a204a5b30a456684a1dd Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<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>Cuenta el número de documentos de esta colección</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>options</parameter><initializer>array()</initializer></methodparam>
|
|
</methodsynopsis>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>query</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Array asociativo u objeto con los campos que deben coincidir.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>options</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Un array de opciones para creación del índice. Las opciones disponibles
|
|
actualmente son:
|
|
<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>
|
|
Índice para la consulta. Si se pasa un string, debería
|
|
corresponderse con un nombre de índice. Si se pasa un array y objeto,
|
|
debería corresponderse con la especificación empelada al crear el índice
|
|
(esto es, el primer argumento de
|
|
<function>MongoCollection::createIndex</function>).
|
|
</para>
|
|
<simpara>Esta opción solamente está soportada en MongoDB 2.6+.</simpara>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry><varname>limit</varname></entry>
|
|
<entry><type>integer</type></entry>
|
|
<entry>El número máximo de documentos coincidentes a devolver.</entry>
|
|
</row>
|
|
<row>
|
|
<entry><varname>maxTimeMS</varname></entry>
|
|
<entry><type>integer</type></entry>
|
|
<entry>
|
|
<para>
|
|
Especifica un límite de tiempo acumulativo en milisegundos para el procesamiento
|
|
de la operación (no incluye tiempo inactivo). Si la operación no se
|
|
completa dentro del período de espera,
|
|
se lanzará una
|
|
<classname>MongoExecutionTimeoutException</classname>.
|
|
</para>
|
|
<simpara>Esta opción solamente está soportada en MongoDB 2.6+.</simpara>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry><varname>skip</varname></entry>
|
|
<entry><type>integer</type></entry>
|
|
<entry>El número de documentos coincidentes a saltarse antes de devolver los resultados.</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve el número de documentos que coinciden con la consulta.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Lanza una <classname>MongoResultException</classname> si el servidor no pudo
|
|
ejecutar el comando debido a un error.
|
|
</para>
|
|
<para>
|
|
Lanza una <classname>MongoExecutionTimeoutException</classname> si la ejecución
|
|
del comando finalizó debido a <varname>maxTimeMS</varname>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>1.6.0</entry>
|
|
<entry>
|
|
El segundo parámetro ahora es el array de opciones <parameter>options</parameter>.
|
|
Pasar <parameter>limit</parameter> y <parameter>skip</parameter> como
|
|
segundo y tercer parámetros, respectivamente, ahora está obsoleto.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>1.0.7</entry>
|
|
<entry>
|
|
Se añadieron los parámetros <parameter>limit</parameter> y <parameter>skip</parameter>
|
|
como segundo y tercer parámetros, respectivamente.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title>Ejemplo de <function>MongoCollection::count</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$collection->insert(array('x'=>1));
|
|
$collection->insert(array('x'=>2));
|
|
$collection->insert(array('x'=>3));
|
|
|
|
var_dump($collection->count());
|
|
var_dump($collection->count(array('x'=>1)));
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
int(3)
|
|
int(1)
|
|
]]>
|
|
</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:"~/.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
|
|
-->
|