php-doc-en/reference/mongo/functions/mongo-gridfs-list.xml
2009-02-25 22:50:52 +00:00

128 lines
2.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.3 $ -->
<refentry xml:id="function.mongo-gridfs-list" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>mongo_gridfs_list</refname>
<refpurpose>Query for files in the grid collection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>mongo_gridfs_list</methodname>
<methodparam><type>resource</type><parameter>gridfs</parameter></methodparam>
<methodparam><type>array</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
Query for files in the grid collection.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>gridfs</parameter></term>
<listitem>
<para>
The gridfs connection to use.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
The file qualities for which to query.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a cursor to information about the matching gridfs files.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>mongo_gridfs_list</function> example</title>
<para>
This example shows how to list the files in a grid collection.
</para>
<programlisting role="php">
<![CDATA[
<?php
$conn = mongo_connect("localhost", true);
if (!$conn) {
die("Could not connect.");
}
// create a new grid connection
$gridfs = mongo_gridfs_init($conn, "blog", "fs");
// query for the filename
$cursor = mongo_gridfs_list($gridfs, array("filename" => "profilePic.jpg"));
while (mongo_has_next($cursor)) {
$f = mongo_next($cursor);
echo $f["filename"] . "\n";
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
file1.txt
file2.txt
mypic.jpg
]]>
</screen>
depending on what is in the database.
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mongo_gridfs_init</function></member>
<member><function>mongo_gridfs_find</function></member>
<member><function>mongo_gridfs_store</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:"../../../../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
-->