From f81e6a03d2e6ba6e72ef01fd14f31d1be83830c6 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Tue, 29 Jan 2013 16:03:18 +0000 Subject: [PATCH] Fix MongoCollection::getIndexInfo() return and example docs https://jira.mongodb.org/browse/PHP-670 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@329340 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../mongo/mongocollection/getindexinfo.xml | 106 ++++++++++-------- 1 file changed, 58 insertions(+), 48 deletions(-) diff --git a/reference/mongo/mongocollection/getindexinfo.xml b/reference/mongo/mongocollection/getindexinfo.xml index eaccd9e440..c3ac0965ed 100644 --- a/reference/mongo/mongocollection/getindexinfo.xml +++ b/reference/mongo/mongocollection/getindexinfo.xml @@ -16,81 +16,91 @@ - &reftitle.parameters; + &reftitle.parameters; &no.function.parameters; &reftitle.returnvalues; - This function returns an array in which each elements describes an array. - The elements contain the values name for the name of - the index, ns for the namespace (the name of the - collection), key containing a list of all the keys - and their sort order that make up the index and _id - containing a MongoID object with the ID of this index. + This function returns an array in which each element describes an index. + Elements will contain the values name for the name of + the index, ns for the namespace (a combination of the + database and collection name), and key for a list of all + fields in the index and their ordering. Additional values may be present for + special indexes, such as unique or + sparse. &reftitle.examples; - <function>MongoCollection::find</function> example - This example demonstrates how to search for a range. + <function>MongoCollection::getIndexInfo</function> example selectCollection('project', 'outfits'); +$m = new MongoClient(); +$c = $m->selectCollection('test', 'venues'); var_dump($c->getIndexInfo()); ?> ]]> - &example.outputs; + &example.outputs.similar; - array(3) { - 'name' => - string(4) '_id_' - 'ns' => - string(12) 'project.outfits' - 'key' => - array(1) { - '_id' => - int(1) - } - } -... - [7] => - array(4) { - '_id' => - class MongoId#12 (1) { - public $$id => string(24) '4d6f7abd44670a1513190000' - } - 'ns' => - string(12) 'project.outfits' - 'key' => - array(2) { - 'created' => - int(-1) - 'userid' => - int(1) - } - 'name' => - string(19) 'created_-1_userid_1' - } -} +array( + 0 => array( + "v" => 1, + "key" => array( + "_id" => 1, + ), + "ns" => "test.venues", + "name" => "_id_", + ), + 1 => array( + "v" => 1, + "key" => array( + "name" => 1, + ), + "unique" : true, + "ns" => "test.venues", + "name" => "name_1", + ), + 2 => array( + "v" => 1, + "key" => array( + "type" => 1, + "createdAt" => -1, + ), + "ns" => "test.venues", + "name" => "type_1_createdAt_-1", + ), + 3 => array( + "v" => 1, + "key" => array( + "location" => "2d", + ), + "ns" => "test.venues", + "name" => "location_2d", + ), +) ]]> - - See MongoCursor for more information how to work with cursors. - + + + &reftitle.seealso; + + MongoDB core docs on + vanilla indexes and + geospatial indexes. + + +