src/League/Monga/Collection.php
public function distinct($key, $query = [])
    {
        if ($query instanceof Closure) {
            // Store the callback
            $callback = $query;

            // Create a new Where filter.
            $query = new Query\Where();

            // trigger callback
            $callback($query);
        }

        if ($query instanceof Query\Where) {
            // Get the filter.
            $query = $query->getWhere();
        }

        return $this->collection->distinct($key, $query);
    }
public function distinct($key, $query = [])
    {
        if ($query instanceof Closure) {
            // Store the callback
            $callback = $query;

            // Create a new Where filter.
            $query = new Query\Where();

            // trigger callback
            $callback($query);
        }

        if ($query instanceof Query\Where) {
            // Get the filter.
            $query = $query->getWhere();
        }

        return $this->collection->distinct($key, $query);
    }
public function distinct ( $ key , $ query = [ ] ) { if ( $ query instanceof Closure ) { // Store the callback $ callback = $ query ; // Create a new Where filter. $ query = new Query \ Where ( ) ; // trigger callback $ callback ( $ query ) ; } if ( $ query instanceof Query \ Where ) { // Get the filter. $ query = $ query -> getWhere ( ) ; } return $ this -> collection -> distinct ( $ key , $ query ) ; }
Returns the distinct values for a given key.

@param string $field field to use
@param mixed  $query match query

@return array array of distinct values
Returns the distinct values for a given key .