lib/Doctrine/MongoDB/Query/Builder.php
public function group($keys, array $initial, $reduce = null, array $options = [])
    {
        $this->query['type'] = Query::TYPE_GROUP;
        $this->query['group'] = [
            'keys' => $keys,
            'initial' => $initial,
            'reduce' => $reduce,
            'options' => $options,
        ];
        return $this;
    }
public function group($keys, array $initial, $reduce = null, array $options = [])
    {
        $this->query['type'] = Query::TYPE_GROUP;
        $this->query['group'] = [
            'keys' => $keys,
            'initial' => $initial,
            'reduce' => $reduce,
            'options' => $options,
        ];
        return $this;
    }
public function group ( $ keys , array $ initial , $ reduce = null , array $ options = [ ] ) { $ this -> query [ 'type' ] = Query :: TYPE_GROUP ; $ this -> query [ 'group' ] = [ 'keys' => $ keys , 'initial' => $ initial , 'reduce' => $ reduce , 'options' => $ options , ] ; return $ this ; }
Change the query type to a group command.

If the "reduce" option is not specified when calling this method, it must
be set with the {@link Builder::reduce()} method.

@see http://docs.mongodb.org/manual/reference/command/group/
@param mixed $keys
@param array $initial
@param string|\MongoCode $reduce
@param array $options
@return $this
Change the query type to a group command .