I don't believe there is a wrapper method in lithium\data\source\MongoDb
for the distinct
command; however, the MongoDb class does compose the PHP driver's Mongo and MongoDB classes, so you can do the following:
// Where $mongodb is an instance of lithium\data\source\MongoDb
$result = $mongodb->connection->command(array(
'distinct' => 'pages',
'key' => 'volume_number',
));
Alternatively, I'm sure Nate Abele would welcome a pull request to Lithium to add support for distinct
to the read()
method, just as it already has for group
(in fact, the current code makes a good starting point to implement this).