Cml\Db\MongoDB\MongoDB::connect PHP Метод

connect() публичный Метод

Db连接
public connect ( string $host, string $username, string $password, string $dbName, string $replicaSet = '', string $engine = '', boolean $pConnect = false ) : mixed
$host string 数据库host
$username string 数据库用户名
$password string 数据库密码
$dbName string 数据库名
$replicaSet string replicaSet名称
$engine string 无用
$pConnect boolean 无用
Результат mixed
    public function connect($host, $username, $password, $dbName, $replicaSet = '', $engine = '', $pConnect = false)
    {
        $authString = "";
        if ($username && $password) {
            $authString = "{$username}:{$password}@";
        }
        $replicaSet && ($replicaSet = '?replicaSet=' . $replicaSet);
        $dsn = "mongodb://{$authString}{$host}/{$dbName}{$replicaSet}";
        return new Manager($dsn);
    }