mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
count and examples, removed util
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@281555 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
c1b6035b04
commit
4cb981d827
5 changed files with 134 additions and 16 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
|
||||
<book xml:id="book.mongo" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Mongo</title>
|
||||
|
@ -39,7 +39,6 @@
|
|||
&reference.mongo.mongogridfs;
|
||||
&reference.mongo.mongogridfsfile;
|
||||
&reference.mongo.mongogridfscursor;
|
||||
&reference.mongo.mongoutil;
|
||||
|
||||
&reference.mongo.mongoid;
|
||||
&reference.mongo.mongocode;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
|
||||
<refentry xml:id="mongocode.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
|
@ -54,8 +54,8 @@
|
|||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>MongoCode::__construct</function> example</title>
|
||||
<programlisting role="php">
|
||||
<title><function>MongoCode::__construct</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
|
@ -64,9 +64,9 @@ var_dump($code);
|
|||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
object(MongoCode)#1 (2) {
|
||||
["scope"]=>
|
||||
|
@ -78,7 +78,25 @@ object(MongoCode)#1 (2) {
|
|||
string(80) "function(x) { for(i=0;i<10;i++) { db.foo.update({x:i}, {x:i+1}); } return x-1; }"
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</screen>
|
||||
</example>
|
||||
|
||||
|
||||
<example>
|
||||
<title>Using <function>MongoCode</function> with $where</title>
|
||||
<para>
|
||||
This example queries a collection for elements where the 'x' fields is less than $y. Notice that
|
||||
PHP objects can be passed into the JavaScript scope and that the JavaScript function returns a boolean.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$cursor = $collection->find(array('$where' => new MongoCode('function() { return this.x < y; }', array('y'=>$y))));
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- $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>
|
||||
|
@ -11,13 +11,37 @@
|
|||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>int</type><methodname>MongoCollection::count</methodname>
|
||||
<void />
|
||||
<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;
|
||||
&no.function.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">
|
||||
|
@ -26,6 +50,36 @@
|
|||
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:
|
||||
|
|
48
reference/mongo/mongocursor/count.xml
Normal file
48
reference/mongo/mongocursor/count.xml
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry xml:id="mongocursor.count" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>MongoCursor::count</refname>
|
||||
<refpurpose>Counts the number of results for this query</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>int</type><methodname>MongoCursor::count</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The number of documents returned by this cursor's query.
|
||||
</para>
|
||||
</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
|
||||
-->
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!--
|
||||
Do NOT translate this file
|
||||
-->
|
||||
|
@ -39,6 +39,7 @@
|
|||
<function name='mongodb::setprofilinglevel' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongodb::createdbref' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongodb::getdbref' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongodb::command' from='PECL mongo >=0.9.2'/>
|
||||
<!-- MongoCollection -->
|
||||
<function name='mongocollection::__construct' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongocollection::__tostring' from='PECL mongo >=0.9.0'/>
|
||||
|
@ -74,9 +75,7 @@
|
|||
<function name='mongocursor::rewind' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongocursor::valid' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongocursor::key' from='PECL mongo >=0.9.0'/>
|
||||
<!-- MongoUtil -->
|
||||
<function name='mongoutil::dbcommand' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongoutil::toindexstring' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongocursor::count' from='PECL mongo >=0.9.2'/>
|
||||
<!-- MongoGridFS -->
|
||||
<function name='mongogridfs::__construct' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongogridfs::find' from='PECL mongo >=0.9.0'/>
|
||||
|
|
Loading…
Reference in a new issue