protected function findDefaultDatabase(string $connectionString)
    {
        preg_match('/\S+\/(\w*)/', $connectionString, $matches);

        if ($matches[1] ?? null) {
            $this->defaultDatabase = $matches[1];
        }
    }
protected function findDefaultDatabase(string $connectionString)
    {
        preg_match('/\S+\/(\w*)/', $connectionString, $matches);

        if ($matches[1] ?? null) {
            $this->defaultDatabase = $matches[1];
        }
    }
protected function findDefaultDatabase ( string $ connectionString ) { preg_match ( '/\S+\/(\w*)/' , $ connectionString , $ matches ) ; if ( $ matches [ 1 ] ?? null ) { $ this -> defaultDatabase = $ matches [ 1 ] ; } }
Find and stores the default database in the connection string.

@param string $connectionString mongoDB connection string
Find and stores the default database in the connection string .