public function replaceRoot($expression = null) : Stage\ReplaceRoot
    {
        $stage = new Stage\ReplaceRoot($this, $this->dm, $this->class, $expression);
        $this->addStage($stage);

        return $stage;
    }
public function replaceRoot($expression = null) : Stage\ReplaceRoot
    {
        $stage = new Stage\ReplaceRoot($this, $this->dm, $this->class, $expression);
        $this->addStage($stage);

        return $stage;
    }
public function replaceRoot ( $ expression = null ) : Stage \ ReplaceRoot { $ stage = new Stage \ ReplaceRoot ( $ this , $ this -> dm , $ this -> class , $ expression ) ; $ this -> addStage ( $ stage ) ; return $ stage ; }
Promotes a specified document to the top level and replaces all other
fields.

The operation replaces all existing fields in the input document,
including the _id field. You can promote an existing embedded document to
the top level, or create a new document for promotion.

@param string|array|null $expression Optional. A replacement expression that
resolves to a document.
Promotes a specified document to the top level and replaces all other fields .