gridfs metadata info

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@296675 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Kristina Chodorow 2010-03-23 14:28:02 +00:00
parent e2cd568fb5
commit 51885bf991

View file

@ -34,13 +34,13 @@
<para>
For example, the files document is something like:
<programlisting>
<programlisting role="php">
<![CDATA[
array("_id" => 123456789, "filename" => "foo.txt", "chunkSize" => 3, "length" => 12)
]]>
</programlisting>
and the chunks documents look like:
<programlisting>
<programlisting role="php">
<![CDATA[
array("files_id" => 123456789, "n" => 0, "data" => new MongoBinData("abc"));
array("files_id" => 123456789, "n" => 1, "data" => new MongoBinData("def"));
@ -52,6 +52,38 @@ array("files_id" => 123456789, "n" => 3, "data" => new MongoBinData("jkl"));
</para>
</section>
<section>
<title>Inter-Language Compatibility</title>
<para>
You should be able to use any files created by MongoGridFS with any other
drivers, and visa vera. However, some drivers expect that all metadata
associated with a file be in a "metadata" field. If you're going to be
using other languages, it's a good idea to wrap info you might want them to
see in a "metadata" field. For example, instead of:
</para>
<programlisting role="php">
<![CDATA[
<?php
$grid->storeFile("somefile.txt", array("date" => new MongoDate()));
?>
]]>
</programlisting>
<para>
use something like:
</para>
<programlisting role="php">
<![CDATA[
<?php
$grid->storeFile("somefile.txt", array("metadata" => array("date" => new MongoDate())));
?>
]]>
</programlisting>
</section>
<section>
<title>The <classname>MongoGridFS</classname> Family</title>