coen-hyde / Shanty-Mongo

Shanty Mongo is a mongodb library for the Zend Framework. Its intention is to make working with mongodb documents as natural and as simple as possible. In particular allowing embedded documents to also have custom document classes.
Other
200 stars 52 forks source link

Something to add #84

Closed zelf closed 12 years ago

zelf commented 12 years ago

Hi, I don't know if you are interested by people posting improvement. (i cannot fork) Anyway: In your file collection.php

I Replaced:

    public static function distinct($property)
    {
        $results = static::getMongoDb(false)->command(array('distinct' => static::getCollectionName(), 'key' => $property);

        return $results['values'];
    }

By this:

    public static function distinct($property, $query = array())
    {
        $results = static::getMongoDb(false)->command(array('distinct' => static::getCollectionName(), 'key' => $property, 'query' => $query));

        return $results['values'];
    }

Following the doc here: http://www.mongodb.org/display/DOCS/Aggregation#Aggregation-Group

Thanks again for your great work. Have a nice day.

coen-hyde commented 12 years ago

thanks for the patch