php-doc-en/reference/mongo/mongomaxkey.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.mongomaxkey" 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 MongoMaxKey class</title>
<titleabbrev>MongoMaxKey</titleabbrev>
<partintro>
<warning>
&mongo.alternative.class.note;
<simplelist role="alternatives">
<member><classname>MongoDB\BSON\MaxKey</classname></member>
</simplelist>
</warning>
<!-- {{{ MongoBinData intro -->
<section xml:id="mongomaxkey.intro">
&reftitle.intro;
<para>
<classname>MongoMaxKey</classname> is an special type used by the database
that compares greater than all other possible BSON values. Thus, if a query
is sorted by a given field in ascending order, any document with a
<classname>MongoMaxKey</classname> as its value will be returned last.
</para>
<para>
<classname>MongoMaxKey</classname> has no associated fields, methods, or
constants. It is merely the "greatest" value that can be represented in the
database.
</para>
<note>
<simpara>
<classname>MongoMaxKey</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="mongomaxkey.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>MongoMaxKey</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>MongoMaxKey</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
</classsynopsis>
<!-- }}} -->
</section>
<section xml:id="mongomaxkey.example">
<title>Using <classname>MongoMaxKey</classname> as a value</title>
<programlisting role="php">
<![CDATA[
<?php
$collection->insert(array("task" => "dishes", "doBy" => new MongoMaxKey));
$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 staff meeting document followed by the dishes
document. The dishes document will always be returned last, regardless of
what else is added to the collection (unless other documents are added with
<classname>MongoMaxKey</classname> in their "doBy" field).
</para>
</section>
<simplesect role="seealso">
&reftitle.seealso;
<simplelist>
<member><classname>MongoMinKey</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
-->