public function buildQuery(iterable $filter, array $opts = [])
    {
        return Pipeline::with($this->stages)
            ->flatten()
            ->reduce(function($data, callable $step) use ($opts) {
                return $step($data, $opts);
            }, $filter);
    }