mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-26 13:58:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@308234 c90b9560-bf6c-de11-be94-00142212c4b1
125 lines
3 KiB
XML
125 lines
3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="mongogridfs.findone" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>MongoGridFS::findOne</refname>
|
|
<refpurpose>Returns a single file matching the criteria</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>MongoGridFSFile</type><methodname>MongoGridFS::findOne</methodname>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>query</parameter><initializer>array()</initializer></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>fields</parameter><initializer>array()</initializer></methodparam>
|
|
</methodsynopsis>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>query</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
The filename or criteria for which to search.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns a <classname>MongoGridFSFile</classname> or &null;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title><methodname>MongoGridFS::findOne</methodname> example</title>
|
|
<para>
|
|
Example demonstrating how to find a single file from the MongoGridFS.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$downloads = $mongo->my_db->getGridFS('downloads');
|
|
|
|
$downloads->storeFile('filename.tgz');
|
|
|
|
$download = $downloads->findOne('filename.tgz'); // instance of MongoGridFSFile
|
|
|
|
print_r($download);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
See <classname>MongoGridFSFile</classname> for more information about how to work with files.
|
|
</para>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
MongoGridFSFile Object
|
|
(
|
|
[file] => Array
|
|
(
|
|
[_id] => MongoId Object
|
|
(
|
|
)
|
|
|
|
[filename] => filename.tgz
|
|
[uploadDate] => MongoDate Object
|
|
(
|
|
[sec] => 1274288014
|
|
[usec] => 467000
|
|
)
|
|
|
|
[chunkSize] => 262144
|
|
[md5] => d41d8cd98f00b204e9800998ecf8427e
|
|
)
|
|
|
|
[gridfs:protected] => MongoGridFS Object
|
|
(
|
|
[chunks] => MongoCollection Object
|
|
(
|
|
)
|
|
|
|
[filesName:protected] => downloads.files
|
|
[chunksName:protected] => downloads.chunks
|
|
)
|
|
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</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
|
|
-->
|