public function distinct($collectionName, $fieldName, $condition = [], $options = [])
    {
        $document = array_merge(
            [
                'distinct' => $collectionName,
                'key' => $fieldName,
            ],
            $options
        );

        if (!empty($condition)) {
            $document['query'] = $this->buildCondition($condition);
        }

        return $document;
    }
public function distinct($collectionName, $fieldName, $condition = [], $options = [])
    {
        $document = array_merge(
            [
                'distinct' => $collectionName,
                'key' => $fieldName,
            ],
            $options
        );

        if (!empty($condition)) {
            $document['query'] = $this->buildCondition($condition);
        }

        return $document;
    }
public function distinct ( $ collectionName , $ fieldName , $ condition = [ ] , $ options = [ ] ) { $ document = array_merge ( [ 'distinct' => $ collectionName , 'key' => $ fieldName , ] , $ options ) ; if ( ! empty ( $ condition ) ) { $ document [ 'query' ] = $ this -> buildCondition ( $ condition ) ; } return $ document ; }
Generates 'distinct' command.
@param string $collectionName collection name.
@param string $fieldName target field name.
@param array $condition filter condition
@param array $options list of options in format: optionName => optionValue.
@return array command document.
Generates distinct command .