|
MongoCollection::distinctRetrieve a list of distinct values for the given key across a collection 説明
public arrayfalse MongoCollection::distinct
( string
$key
[, array $query
] )The distinct command returns a list of distinct values for the given key across a collection. パラメータ
返り値
Returns an array of distinct values, 失敗した場合に 例例1 MongoCollection::distinct example
<?php 上の例の出力は以下となります。 array(2) { [0]=> int(10010) [1]=> int(99701) } array(1) { [0]=> int(10010) } array(2) { [0]=> int(10010) [1]=> int(99701) } 例2 MongoCollection::distinct example on a embedded document
<?php 上の例の出力は以下となります。 array(2) { [0]=> int(25) [1]=> int(31) } array(0) { } |