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
This commit is contained in:
Jeremy Mikola 2013-01-29 16:03:18 +00:00
parent 04b11e621f
commit f81e6a03d2

View file

@ -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: