mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Clarify that MongoMaxKey/MongoMinKey are primarily for internal use
This also revises some language in the usage examplex for both classes. https://jira.mongodb.org/browse/PHP-1375 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335733 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
2f12b12b10
commit
58374fa210
2 changed files with 49 additions and 21 deletions
|
@ -12,16 +12,23 @@
|
|||
<section xml:id="mongomaxkey.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
<classname>MongoMaxKey</classname> is a special type used by the database
|
||||
that evaluates to greater than any other type. Thus, if a query is sorted
|
||||
by a given field in ascending order, any document with a
|
||||
<classname>MongoMaxKey</classname> is an special type used by the database
|
||||
that compares greather 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 "largest" thing that can be inserted into the
|
||||
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>
|
||||
<!-- }}} -->
|
||||
|
||||
|
@ -50,21 +57,28 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$collection->insert(array("task" => "dishes", "do by" => new MongoMaxKey));
|
||||
$collection->insert(array("task" => "staff meeting", "do by" => new MongoDate(strtotime("+4 days"))));
|
||||
$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("do by" => 1));
|
||||
$cursor = $collection->find()->sort(array("doBy" => 1));
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The cursor will contain the staff meeting document, then the dishes
|
||||
document. The dishes document will always be returned last, regardless of
|
||||
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 the "do by" field).
|
||||
<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>
|
||||
|
|
|
@ -12,16 +12,23 @@
|
|||
<section xml:id="mongominkey.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
<classname>MongoMinKey</classname> is a special type used by the database
|
||||
that evaluates to less than any other type. Thus, if a query is sorted by a
|
||||
given field in ascending order, any document with a
|
||||
<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" thing that can be inserted into the
|
||||
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>
|
||||
<!-- }}} -->
|
||||
|
||||
|
@ -50,21 +57,28 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$collection->insert(array("task" => "lunch", "do by" => new MongoMinKey));
|
||||
$collection->insert(array("task" => "staff meeting", "do by" => new MongoDate(strtotime("+4 days"))));
|
||||
$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("do by" => 1));
|
||||
$cursor = $collection->find()->sort(array("doBy" => 1));
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The cursor will contain the lunch document, then 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 the "do by" field).
|
||||
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>
|
||||
|
|
Loading…
Reference in a new issue