svn: /phpdoc/en/trunk/reference/mongo/ mongocollection/ensureindex.xml updates.xml
| From: | Kristina Chodorow | Date: | Thu, 25 Mar 2010 17:47:33 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/mongo/ mongocollection/ensureindex.xml updates.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-6270@lists.php.net to get a copy of this message | ||
kristina Thu, 25 Mar 2010 17:47:33 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=296798
Log:
$ operator and geospatial indexes
Changed paths:
U phpdoc/en/trunk/reference/mongo/mongocollection/ensureindex.xml
U phpdoc/en/trunk/reference/mongo/updates.xml
Modified: phpdoc/en/trunk/reference/mongo/mongocollection/ensureindex.xml
===================================================================
--- phpdoc/en/trunk/reference/mongo/mongocollection/ensureindex.xml 2010-03-25 17:46:23 UTC (rev
296797)
+++ phpdoc/en/trunk/reference/mongo/mongocollection/ensureindex.xml 2010-03-25 17:47:33 UTC (rev
296798)
@@ -190,12 +190,32 @@
]]>
</programlisting>
</example>
+
+ <example>
+ <title>Geospatial Indexing</title>
+ <para>
+ Mongo supports geospatial indexes, which allow you to search for documents
+ near a given location or within a shape. For example, to create a
+ geospatial index on the "loc" field:
+ </para>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$collection->ensureIndex(array("loc" => "2d"));
+
+?>
+]]>
+ </programlisting>
+ </example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
- MongoDB core docs on <link
xlink:href="&url.mongodb.dochub.indexes;">indexes</link>.
+ MongoDB core docs on
+ <link xlink:href="&url.mongodb.dochub.indexes;">vanilla indexes</link>
and
+ <link xlink:href="&url.mongodb.dochub.geo;">geospatial indexes</link>.
</para>
</refsect1>
Modified: phpdoc/en/trunk/reference/mongo/updates.xml
===================================================================
--- phpdoc/en/trunk/reference/mongo/updates.xml 2010-03-25 17:46:23 UTC (rev 296797)
+++ phpdoc/en/trunk/reference/mongo/updates.xml 2010-03-25 17:47:33 UTC (rev 296798)
@@ -52,6 +52,27 @@
</programlisting>
</para>
</section>
+
+ <section>
+ <title>The Positional Operator</title>
+ <para>
+ The positional operator <literal>$</literal> is useful for updating objects
+ that are in arrays. In the example above, for instance, suppose that we did
+ not know the index of the comment that we needed to change, merely that we
+ needed to change "John" to "Jim". We can use
<literal>$</literal> to do so.
+ </para>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$blog->update(
+ array("comments.author" => "John"),
+ array('$set' => array('comments.$.author' => "Jim")));
+
+?>
+]]>
+ </programlisting>
+ </section>
</section>
<!-- Keep this comment at the end of the file