我的文件如下:
[_id] => MongoId Object (
[$id] => ...
)
[homeId] => 39898
[sensor] => bopt
[date] => MongoDate Object (
[sec] => 1376258370
[usec] => 0
)
[val] => 5687
我要查询'date.sec','sensor','homeId'和'val'。 问题是,我希望'val'成为DISTINCT
$this->condition = array('homeId' => (int)$this->homeId, 'date' => array('$gte' => new MongoDate($this->fromDate), '$lt' => new MongoDate($this->toDate)), 'sensor' => $this->sensor);
$cursor = $this->collection->distinct('val',$this->condition);
我怎样才能让它不仅返回'val'而且返回所有字段?
谢谢!