php-doc-en/reference/mongo/mongominkey.xml
2016-02-22 12:36:13 +00:00

112 lines
3.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.mongominkey" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The MongoMinKey class</title>
<titleabbrev>MongoMinKey</titleabbrev>
<partintro>
<warning>
&mongo.alternative.class.note;
<simplelist role="alternatives">
<member><classname>MongoDB\BSON\MinKey</classname></member>
</simplelist>
</warning>
<!-- {{{ MongoBinData intro -->
<section xml:id="mongominkey.intro">
&reftitle.intro;
<para>
<classname>MongoMinKey</classname> is an special type used by the database
that compares less than all other possible BSON values. Thus, if a query is
sorted by a given field in ascending order, any document with a
<classname>MongoMinKey</classname> as its value will be returned first.
</para>
<para>
<classname>MongoMinKey</classname> has no associated fields, methods, or
constants. It is merely the "smallest" value that can be represented in the
database.
</para>
<note>
<simpara>
<classname>MongoMinKey</classname> is used internally by MongoDB for
indexing and sharding. There is generally no reason to use this class in
an application.
</simpara>
</note>
</section>
<!-- }}} -->
<section xml:id="mongominkey.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>MongoMinKey</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>MongoMinKey</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
</classsynopsis>
<!-- }}} -->
</section>
<section xml:id="mongominkey.example">
<title>Using <classname>MongoMinKey</classname> as a value</title>
<programlisting role="php">
<![CDATA[
<?php
$collection->insert(array("task" => "lunch", "doBy" => new MongoMinKey));
$collection->insert(array("task" => "staff meeting", "doBy" => new MongoDate(strtotime("+4 days"))));
$cursor = $collection->find()->sort(array("doBy" => 1));
?>
]]>
</programlisting>
<para>
The cursor will return the lunch document followed by the staff meeting
document. The lunch document will always be returned first, regardless of
what else is added to the collection (unless other documents are added with
<classname>MongoMinKey</classname> in their "doBy" field).
</para>
</section>
<simplesect role="seealso">
&reftitle.seealso;
<simplelist>
<member><classname>MongoMaxKey</classname></member>
</simplelist>
</simplesect>
</partintro>
</phpdoc:classref>
<!-- 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
-->