mongo.cmd ini opt, examples

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@290037 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Kristina Chodorow 2009-10-28 21:10:00 +00:00
parent 20b294f432
commit ba9e4bfd22
5 changed files with 113 additions and 100 deletions

View file

@ -36,7 +36,6 @@
&reference.mongo.mongodb;
&reference.mongo.mongocollection;
&reference.mongo.mongocursor;
&reference.mongo.mongoemptyobj;
&reference.mongo.mongogridfs;
&reference.mongo.mongogridfsfile;
&reference.mongo.mongogridfscursor;

View file

@ -51,6 +51,11 @@
<entry>262144</entry>
<entry>PHP_INI_SYSTEM</entry>
</row>
<row>
<entry><link linkend="ini.mongo.cmd">mongo.cmd</link></entry>
<entry>$</entry>
<entry>PHP_INI_ALL</entry>
</row>
</tbody>
</tgroup>
</table>
@ -152,6 +157,18 @@
</listitem>
</varlistentry>
<varlistentry xml:id="ini.mongo.cmd">
<term>
<parameter>mongo.cmd</parameter>
<type>string</type>
</term>
<listitem>
<para>
A character to be used in place of $.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</section>

View file

@ -60,6 +60,44 @@
Returns if the update was successfully sent to the database.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>MongoCollection::update</function></title>
<para>
Adding an address field to a document.
</para>
<programlisting role="php">
<![CDATA[
<?php
$c->insert(array("firstname" => "Bob", "lastname" => "Jones" ));
$newdata = array('$set' => array("address" => "1 Smith Lane"));
$c->update(array("firstname" => "Bob"), $newdata);
var_dump($c->findOne(array("firstname" => "Bob")));
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
array(4) {
["_id"]=>
object(MongoId)#6 (0) {
}
["firstname"]=>
string(3) "Bob"
["lastname"]=>
string(5) "Jones"
["address"]=>
string(12) "1 Smith Lane"
}
]]>
</screen>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -23,9 +23,66 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the error, if there was one, or &null;.
Returns the error, if there was one.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>MongoDB::lastError</function> &null; error example</title>
<programlisting role="php">
<![CDATA[
<?php
$db->resetError();
var_dump($db->lastError());
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
array(3) {
["err"]=>
NULL
["n"]=>
int(0)
["ok"]=>
float(1)
}
]]>
</screen>
</example>
<example>
<title><function>MongoDB::lastError</function> duplicate key example</title>
<programlisting role="php">
<![CDATA[
<?php
$c = $db->selectCollection("foo");
// insert two documents with the same _id
$c->insert(array("_id" => 1));
$c->insert(array("_id" => 1));
var_dump($db->lastError());
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
array(3) {
["err"]=>
string(64) "E11000 duplicate key errorindex: foo.foo.$_id_ dup key: { : 1 }"
["n"]=>
int(0)
["ok"]=>
float(1)
}
]]>
</screen>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,98 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.mongoemptyobj" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The MongoEmptyObj class</title>
<titleabbrev>MongoEmptyObj</titleabbrev>
<partintro>
<!-- {{{ MongoEmptyObj intro -->
<section xml:id="mongoemptyobj.intro">
&reftitle.intro;
<para>
This class is used to insert an empty object into the database.
</para>
<para>
Inserting an empty array will create an array-type document, which can
be used for (among other things) $push updates:
</para>
<programlisting role="php">
<![CDATA[
<?php
$collection->insert(array('x' => array()));
?>
]]>
</programlisting>
<para>The shell shows that an empty array is saved as an array:</para>
<programlisting role="javascript">
<![CDATA[
> db.collection.findOne()
{ 'x' : [] }
]]>
</programlisting>
<para>
Inserting a MongoEmptyObj will create an object-type document:
</para>
<programlisting role="php">
<![CDATA[
<?php
$collection->insert(array('x' => new MongoEmptyObj()));
?>
]]>
</programlisting>
<para>The shell shows that a MongoEmptyObj is saved as an object:</para>
<programlisting role="javascript">
<![CDATA[
> db.collection.findOne()
{ 'x' : {} }
]]>
</programlisting>
</section>
<!-- }}} -->
<section xml:id="mongoemptyobj.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>MongoEmptyObj</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>MongoEmptyObj</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
</phpdoc:classref>
<!-- 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
indent-tabs-mode:nil
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
-->