PHP Doku:: The MongoMaxKey class - class.mongomaxkey.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenMongoDB Native DriverTypesThe MongoMaxKey class

Ein Service von Reinhard Neidl - Webprogrammierung.

Types

<<The MongoMinKey class

The MongoTimestamp class>>

The MongoMaxKey class

Einführung

MongoMaxKey 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 MongoMaxKey as its value will be returned last.

MongoMaxKey has no associated fields, methods, or constants. It is merely the "largest" thing that can be inserted into the database.

Klassenbeschreibung

MongoMaxKey {
}

Using MongoMaxKey as a value

<?php

$collection
->insert(array("task" => "dishes""do by" => new MongoMaxKey));
$collection->insert(array("task" => "staff meeting""do by" => new MongoDate(strtotime("+4 days"))));

$cursor $collection->find()->sort(array("do by" => 1));

?>

The cursor will contain the staff meeting document, then 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 MongoMaxKey in the "do by" field).


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)