diff --git a/reference/mongo/mongocollection/ensureindex.xml b/reference/mongo/mongocollection/ensureindex.xml index d9dcce1c9b..fc2bb80283 100644 --- a/reference/mongo/mongocollection/ensureindex.xml +++ b/reference/mongo/mongocollection/ensureindex.xml @@ -186,6 +186,24 @@ $collection->ensureIndex(array("username" => 1), array("unique" => 1, "dropDups" */ $collection->insert(array("username" => "joeschmoe")); +?> +]]> + + + + + Geospatial Indexing + + 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: + + +ensureIndex(array("loc" => "2d")); + ?> ]]> @@ -195,7 +213,9 @@ $collection->insert(array("username" => "joeschmoe")); &reftitle.seealso; - MongoDB core docs on indexes. + MongoDB core docs on + vanilla indexes and + geospatial indexes. diff --git a/reference/mongo/updates.xml b/reference/mongo/updates.xml index 52ead6501d..da7933ce21 100644 --- a/reference/mongo/updates.xml +++ b/reference/mongo/updates.xml @@ -52,6 +52,27 @@ $blog->update($criteria, array('$set' => array("comments.1" => array("author" => + +
+ The Positional Operator + + The positional operator $ 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 $ to do so. + + +update( + array("comments.author" => "John"), + array('$set' => array('comments.$.author' => "Jim"))); + +?> +]]> + +