public function pipeline($builder) : self
    {
        if (! $this->field) {
            throw new LogicException(__METHOD__ . ' requires you set a current field using field().');
        }

        if ($builder instanceof Stage) {
            $builder = $builder->builder;
        }

        if (! $builder instanceof Builder) {
            throw new InvalidArgumentException(__METHOD__ . ' expects either an aggregation builder or an aggregation stage.');
        }

        $this->pipelines[$this->field] = $builder;
        return $this;
    }
public function pipeline($builder) : self
    {
        if (! $this->field) {
            throw new LogicException(__METHOD__ . ' requires you set a current field using field().');
        }

        if ($builder instanceof Stage) {
            $builder = $builder->builder;
        }

        if (! $builder instanceof Builder) {
            throw new InvalidArgumentException(__METHOD__ . ' expects either an aggregation builder or an aggregation stage.');
        }

        $this->pipelines[$this->field] = $builder;
        return $this;
    }
public function pipeline ( $ builder ) : self { if ( ! $ this -> field ) { throw new LogicException ( __METHOD__ . ' requires you set a current field using field().' ) ; } if ( $ builder instanceof Stage ) { $ builder = $ builder -> builder ; } if ( ! $ builder instanceof Builder ) { throw new InvalidArgumentException ( __METHOD__ . ' expects either an aggregation builder or an aggregation stage.' ) ; } $ this -> pipelines [ $ this -> field ] = $ builder ; return $ this ; }
Use the given pipeline for the current field.

@param Builder|Stage $builder
Use the given pipeline for the current field .