svn: /phpdoc/en/trunk/reference/mongo/mongocollection/ getindexinfo.xml

From: Date: Tue, 29 Jan 2013 16:03:18 +0000
Subject: svn: /phpdoc/en/trunk/reference/mongo/mongocollection/ getindexinfo.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-10977@lists.php.net to get a copy of this message
jmikola Tue, 29 Jan 2013 16:03:18 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=329340 Log: Fix MongoCollection::getIndexInfo() return and example docs https://jira.mongodb.org/browse/PHP-670 Changed paths: U phpdoc/en/trunk/reference/mongo/mongocollection/getindexinfo.xml Modified: phpdoc/en/trunk/reference/mongo/mongocollection/getindexinfo.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/mongocollection/getindexinfo.xml 2013-01-29 14:57:48 UTC (rev 329339) +++ phpdoc/en/trunk/reference/mongo/mongocollection/getindexinfo.xml 2013-01-29 16:03:18 UTC (rev 329340) @@ -16,81 +16,91 @@ </refsect1> <refsect1 role="parameters"> - &reftitle.parameters; + &reftitle.parameters; &no.function.parameters; </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - This function returns an array in which each elements describes an array. - The elements contain the values <literal>name</literal> for the name of - the index, <literal>ns</literal> for the namespace (the name of the - collection), <literal>key</literal> containing a list of all the keys - and their sort order that make up the index and <literal>_id</literal> - 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 <literal>name</literal> for the name of + the index, <literal>ns</literal> for the namespace (a combination of the + database and collection name), and <literal>key</literal> for a list of all + fields in the index and their ordering. Additional values may be present for + special indexes, such as <literal>unique</literal> or + <literal>sparse</literal>. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <example> - <title><function>MongoCollection::find</function> example</title> - <para>This example demonstrates how to search for a range.</para> + <title><function>MongoCollection::getIndexInfo</function> example</title> <programlisting role="php"> <![CDATA[ <?php -$m = new Mongo; -$c = $m->selectCollection('project', 'outfits'); +$m = new MongoClient(); +$c = $m->selectCollection('test', 'venues'); var_dump($c->getIndexInfo()); ?> ]]> </programlisting> - &example.outputs; + &example.outputs.similar; <screen> <![CDATA[ -array(8) { - [0] => - 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", + ), +) ]]> </screen> - <para> - See <classname>MongoCursor</classname> for more information how to work with cursors. - </para> </example> </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + 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> + </refentry> <!-- Keep this comment at the end of the file Local variables:

« previous php.doc.cvs (#10977) next »