lib/Doctrine/MongoDB/Query/Builder.php
public function reduce($reduce)
    {
        switch ($this->query['type']) {
            case Query::TYPE_MAP_REDUCE:
                $this->query['mapReduce']['reduce'] = $reduce;
                break;

            case Query::TYPE_GROUP:
                $this->query['group']['reduce'] = $reduce;
                break;

            default:
                throw new BadMethodCallException('mapReduce(), map() or group() must be called before reduce()');
        }

        return $this;
    }
public function reduce($reduce)
    {
        switch ($this->query['type']) {
            case Query::TYPE_MAP_REDUCE:
                $this->query['mapReduce']['reduce'] = $reduce;
                break;

            case Query::TYPE_GROUP:
                $this->query['group']['reduce'] = $reduce;
                break;

            default:
                throw new BadMethodCallException('mapReduce(), map() or group() must be called before reduce()');
        }

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

@param string|\MongoCode $reduce
@return $this
@throws BadMethodCallException if the query is not a mapReduce or group command
Set the reduce option for a mapReduce or group command .