PHP » GoLang |
login |
register |
about
|
GoLang MongoCollection::distinct
request it (570)
GoLang replacement for PHP's MongoCollection::distinct
[edit | history]
MongoCollection::distinct(PECL mongo >=1.2.11) MongoCollection::distinct — Retrieve a list of distinct values for the given key across a collection Description
public array MongoCollection::distinct
( string
$key
[, array $query
] )The distinct command returns a list of distinct values for the given key across a collection. Parameters
Return Values
Returns an array of distinct values, or ExamplesExample #1 MongoCollection::distinct() example
<?phpThe above example will output:
array(2) {
[0]=>
int(10010)
[1]=>
int(99701)
}
array(1) {
[0]=>
int(10010)
}
array(2) {
[0]=>
int(10010)
[1]=>
int(99701)
}
Example #2 MongoCollection::distinct() example on a embedded document
<?phpThe above example will output:
array(2) {
[0]=>
int(25)
[1]=>
int(31)
}
array(0) {
}
|
more
Most requested
more
Last requests
|