php-doc-en/reference/mongo/mongodb/getcollectioninfo.xml
Jeremy Mikola 2fba051b83 Update example output for MongoDB::getCollectionInfo()
This returns a numerically indexed array and collection names do not include the namespace prefix.

https://jira.mongodb.org/browse/PHP-1376
https://jira.mongodb.org/browse/PHP-1378


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335756 c90b9560-bf6c-de11-be94-00142212c4b1
2015-01-15 16:22:40 +00:00

145 lines
3.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 329340 $ -->
<refentry xml:id="mongodb.getcollectioninfo" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoDB::getCollectionInfo</refname>
<refpurpose>Returns information about collections in this database</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>array</type><methodname>MongoDB::getCollectionInfo</methodname>
<methodparam choice="opt"><type>array</type><parameter>options</parameter><initializer>array()</initializer></methodparam>
</methodsynopsis>
<para>
Gets a list of all collections in the database and returns them as an array
of documents, which contain their names and options.
</para>
&mongo.listcollections.note;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term>
<parameter>options</parameter>
</term>
<listitem>
<para>
An array of options for listing the collections. Currently available
options include:
<itemizedlist>
&mongo.listcollections.parameters.filter;
&mongo.listcollections.parameters.includesystemcollections;
</itemizedlist>
</para>
<para>
The following option may be used with MongoDB 2.8+:
<itemizedlist>
&mongo.command.parameters.maxtimems;
</itemizedlist>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
This function returns an array where each element is an array describing a
collection. Elements will contain a <literal>name</literal> key denoting the
name of the collection, and optionally contain an <literal>options</literal>
key denoting an array of objects used to create the collection. For example,
capped collections will include <literal>capped</literal> and
<literal>size</literal> options.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
For MongoDB 2.6 and earlier, <classname>MongoException</classname> will be
thrown if a non-string value was specified for the
<literal>"filter"</literal> option's <literal>"name"</literal> criteria.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>MongoDB::getCollectionInfo</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$m = new MongoClient();
$db = $m->selectDB("demo");
var_dump($db->getCollectionInfo());
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
array(2) {
[0]=>
array(2) {
["name"]=>
string(4) "logs"
["options"]=>
array(2) {
["capped"]=>
bool(true)
["size"]=>
int(10240)
}
}
[1]=>
array(2) {
["name"]=>
string(5) "users"
["options"]=>
array(1) {
["flags"]=>
int(1)
}
}
}
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>MongoDB::getCollectionNames</function></member>
<member><function>MongoDB::listCollections</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->