[prev in list] [next in list] [prev in thread] [next in thread]
List: php-doc-cvs
Subject: [DOC-CVS] =?utf-8?q?svn:_/phpdoc/en/trunk/reference/mongo/mongocollection/_update.xml?=
From: Derick_Rethans <derick () php ! net>
Date: 2011-12-29 14:59:50
Message-ID: svn-derick-1325170790-321511-744305519 () svn ! php ! net
[Download RAW message or body]
derick Thu, 29 Dec 2011 14:59:50 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=321511
Log:
Layout and rename newobj to new_object.
Changed paths:
U phpdoc/en/trunk/reference/mongo/mongocollection/update.xml
Modified: phpdoc/en/trunk/reference/mongo/mongocollection/update.xml
===================================================================
--- phpdoc/en/trunk/reference/mongo/mongocollection/update.xml 2011-12-29 14:57:37 \
UTC (rev 321510)
+++ phpdoc/en/trunk/reference/mongo/mongocollection/update.xml 2011-12-29 14:59:50 \
UTC (rev 321511) @@ -12,7 +12,7 @@
<methodsynopsis>
<modifier>public</modifier> \
<type>bool|array</type><methodname>MongoCollection::update</methodname> \
<methodparam><type>array</type><parameter>criteria</parameter></methodparam>
- <methodparam><type>array</type><parameter>newobj</parameter></methodparam>
+ <methodparam><type>array</type><parameter>new_object</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>options</parameter><initializer>array()</initializer></methodparam>
</methodsynopsis>
</refsect1>
@@ -33,7 +33,7 @@
</varlistentry>
<varlistentry>
<term>
- <parameter>newobj</parameter>
+ <parameter>new_object</parameter>
</term>
<listitem>
<para>
@@ -56,8 +56,9 @@
<literal>"upsert"</literal>
</para>
<para>
- If no document matches $criteria, a new document will be created from
- $criteria and $newobj (see upsert example below).
+ If no document matches <parameter>$criteria</parameter>, a new
+ document will be created from <parameter>$criteria</parameter> and
+ <parameter>$new_object</parameter> (see upsert example below).
</para>
</listitem>
<listitem>
@@ -294,17 +295,22 @@
]]>
</screen>
<para>
- If <literal>newobj</literal> does not contain $-operators, an upsert will
- create a new document from it alone. This matches the behavior of a normal
- update, where not using $-operators causes the whole document to be
- overwritten.
+ If <parameter>$new_object</parameter> does not contain $-operators, an upsert \
will + create a new document from the passed fields only. This matches the
+ behavior of a normal update, where not using $-operators causes the whole
+ document to be overwritten.
</para>
<programlisting role="php">
<![CDATA[
<?php
-$c->update(array("name" => "joe"), array("username" => "joe312", "createdAt" => new \
MongoDate()),
- array("upsert" => true));
+$c->drop();
+$c->update(
+ array("name" => "joe"),
+ array("username" => "joe312", "createdAt" => new MongoDate()),
+ array("upsert" => true)
+);
+var_dump($c->findOne());
?>
]]>
@@ -329,8 +335,8 @@
<title><function>MongoCollection::update</function> multiple example</title>
<para>
By default, <function>MongoCollection::update</function> will only update
- the first document matching $criteria that it finds. Using the "multiple"
- option can override this behavior, if needed.
+ the first document matching <parameter>$criteria</parameter> that it
+ finds. Using the "multiple" option can override this behavior, if needed.
</para>
<para>
This example adds a "gift" field to every person whose birthday is in the
@@ -341,7 +347,11 @@
<?php
$today = array('$gt' => new MongoDate(), '$lt' => new MongoDate(strtotime("+1 \
day")));
-$people->update(array("birthday" => $today), array('$set' => array('gift' => \
$surprise)), array("multiple" => true)); +$people->update(
+ array("birthday" => $today),
+ array('$set' => array('gift' => $surprise)),
+ array("multiple" => true)
+);
?>
]]>
--
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic