I want to find distinct records from a collected "pages".
I tried:
$Volume_numbers = Pages::find(array('fields'=>'DISTINCT volume_number'));
I also tried:
$params = array('conditions'=>array(
'distinct' => 'pages',
'key' => 'volume_number',
));
$pageVolumes = Pages::all($params);
as suggested in MongoDB documentation and also in one of the answers.
When I try to execute this through Mongo, I get correct results
> db.runCommand({distinct:'pages',key:'volume_number'})
{
"values" : [
22,
38
],
"stats" : {
"n" : 1084,
"nscanned" : 1084,
"nscannedObjects" : 1084,
"timems" : 25,
"cursor" : "BasicCursor"
},
"ok" : 1
}