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

finalize() public method

Set the "finalize" option for a mapReduce or group command.
public finalize ( string | MongoCode $finalize )
$finalize string | MongoCode
    public function finalize($finalize)
    {
        switch ($this->query['type']) {
            case Query::TYPE_MAP_REDUCE:
                $this->query['mapReduce']['options']['finalize'] = $finalize;
                break;
            case Query::TYPE_GROUP:
                $this->query['group']['options']['finalize'] = $finalize;
                break;
            default:
                throw new BadMethodCallException('mapReduce(), map() or group() must be called before finalize()');
        }
        return $this;
    }