lib/Doctrine/MongoDB/Collection.php
protected function doDistinct($field, array $query, array $options)
    {
        list($commandOptions, $clientOptions) = isset($options['socketTimeoutMS']) || isset($options['timeout'])
            ? $this->splitCommandAndClientOptions($options)
            : [$options, []];

        $command = [];
        $command['distinct'] = $this->mongoCollection->getName();
        $command['key'] = $field;
        $command['query'] = (object) $query;
        $command = array_merge($command, $commandOptions);

        $database = $this->database;
        $result = $this->retry(function() use ($database, $command, $clientOptions) {
            return $database->command($command, $clientOptions);
        });

        if (empty($result['ok'])) {
            throw new ResultException($result);
        }

        $arrayIterator = new ArrayIterator(isset($result['values']) ? $result['values'] : []);
        $arrayIterator->setCommandResult($result);

        return $arrayIterator;
    }
protected function doDistinct($field, array $query, array $options)
    {
        list($commandOptions, $clientOptions) = isset($options['socketTimeoutMS']) || isset($options['timeout'])
            ? $this->splitCommandAndClientOptions($options)
            : [$options, []];

        $command = [];
        $command['distinct'] = $this->mongoCollection->getName();
        $command['key'] = $field;
        $command['query'] = (object) $query;
        $command = array_merge($command, $commandOptions);

        $database = $this->database;
        $result = $this->retry(function() use ($database, $command, $clientOptions) {
            return $database->command($command, $clientOptions);
        });

        if (empty($result['ok'])) {
            throw new ResultException($result);
        }

        $arrayIterator = new ArrayIterator(isset($result['values']) ? $result['values'] : []);
        $arrayIterator->setCommandResult($result);

        return $arrayIterator;
    }
protected function doDistinct ( $ field , array $ query , array $ options ) { list ( $ commandOptions , $ clientOptions ) = isset ( $ options [ 'socketTimeoutMS' ] ) || isset ( $ options [ 'timeout' ] ) ? $ this -> splitCommandAndClientOptions ( $ options ) : [ $ options , [ ] ] ; $ command = [ ] ; $ command [ 'distinct' ] = $ this -> mongoCollection -> getName ( ) ; $ command [ 'key' ] = $ field ; $ command [ 'query' ] = ( object ) $ query ; $ command = array_merge ( $ command , $ commandOptions ) ; $ database = $ this -> database ; $ result = $ this -> retry ( function ( ) use ( $ database , $ command , $ clientOptions ) { return $ database -> command ( $ command , $ clientOptions ) ; } ) ; if ( empty ( $ result [ 'ok' ] ) ) { throw new ResultException ( $ result ) ; } $ arrayIterator = new ArrayIterator ( isset ( $ result [ 'values' ] ) ? $ result [ 'values' ] : [ ] ) ; $ arrayIterator -> setCommandResult ( $ result ) ; return $ arrayIterator ; }
Execute the distinct command.

@see Collection::distinct()
@param string $field
@param array  $query
@param array  $options
@return ArrayIterator
@throws ResultException if the command fails
Execute the distinct command .