php-doc-en/reference/mongo/mongodb/getcollectionnames.xml
Christoph Michael Becker af5f2f87b3 Add PECL in front of version numbers in changelogs
Patch contributed by Benjamin Morel <benjamin.morel@gmail.com>.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@350988 c90b9560-bf6c-de11-be94-00142212c4b1
2020-10-25 15:11:56 +00:00

151 lines
3.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mongodb.getcollectionnames" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoDB::getCollectionNames</refname>
<refpurpose>Gets an array of names for all collections in this database</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>array</type><methodname>MongoDB::getCollectionNames</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 their names as an
array of strings.
</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>
Returns the collection names as an array of strings.
</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="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>PECL mongo 1.6.0</entry>
<entry>
Changed first parameter to be an array of options. Pre-1.6.0, the
first parameter was a boolean indicating the
<literal>"includeSystemCollections"</literal> option.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>MongoDB::getCollectionNames</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$m = new MongoClient();
$db = $m->selectDB("demo");
$collections = $db->getCollectionNames();
foreach ($collections as $collectionName) {
echo "Found collection: ", $collectionName, "\n";
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
Found collection: img
Found collection: beer
Found collection: collation
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>MongoDB::listCollections</function></member>
<member><function>MongoDB::getCollectionInfo</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
indent-tabs-mode:nil
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
-->