|
MongoCollection::distinctRetrieve a list of distinct values for the given key across a collection. Beschreibung
public array MongoCollection::distinct
( string
$key
[, array $query
] )The distinct command returns a list of distinct values for the given key across a collection. Parameter-Liste
Rückgabewerte
Returns an array of distinct values, Im Fehlerfall wird BeispieleBeispiel #1 MongoCollection::distinct example
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe:
array(2) {
[0]=>
int(10010)
[1]=>
int(99701)
}
array(1) {
[0]=>
int(10010)
}
array(2) {
[0]=>
int(10010)
[1]=>
int(99701)
}
Beispiel #2 MongoCollection::distinct example on a embedded document
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe:
array(2) {
[0]=>
int(25)
[1]=>
int(31)
}
array(0) {
}
|