yii\mongodb\Session::regenerateID PHP Method

regenerateID() public method

Please refer to for more details.
public regenerateID ( boolean $deleteOldSession = false )
$deleteOldSession boolean Whether to delete the old associated session file or not.
    public function regenerateID($deleteOldSession = false)
    {
        $oldID = session_id();
        // if no session is started, there is nothing to regenerate
        if (empty($oldID)) {
            return;
        }
        parent::regenerateID(false);
        $newID = session_id();
        $collection = $this->db->getCollection($this->sessionCollection);
        $row = $collection->findOne(['id' => $oldID]);
        if ($row !== null) {
            if ($deleteOldSession) {
                $collection->update(['id' => $oldID], ['id' => $newID]);
            } else {
                unset($row['_id']);
                $row['id'] = $newID;
                $collection->insert($row);
            }
        } else {
            // shouldn't reach here normally
            $collection->insert($this->composeFields($newID, ''));
        }
    }