public function match($filter)
    {
        if ($filter instanceof Closure) {
            // Store the callback
            $callback = $filter;

            // Set a new Where filter
            $filter = new Where();

            // Execute the callback
            $callback($filter);
        }

        if ($filter instanceof Where) {
            $filter = $filter->getWhere();
        }

        $this->pipeline[] = ['$match' => $filter];

        return $this;
    }