Doctrine\MongoDB\Query\Builder::group PHP Method

group() public method

If the "reduce" option is not specified when calling this method, it must be set with the {@link Builder::reduce()} method.
See also: http://docs.mongodb.org/manual/reference/command/group/
public group ( mixed $keys, array $initial, string | MongoCode $reduce = null, array $options = [] )
$keys mixed
$initial array
$reduce string | MongoCode
$options array
    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;
    }