protected function getDsn(array $config)
{
// First we will create the basic DSN setup as well as the port if it is in
// in the configuration options. This will give us the basic DSN we will
// need to establish the MongoClient and return them back for use.
extract($config);
$dsn = "mongodb://";
if (isset($config['username']) and isset($config['password'])) {
$dsn .= "{$username}:{$password}@";
}
$dsn .= "{$host}";
if (isset($config['port'])) {
$dsn .= ":{$port}";
}
$dsn .= "/{$database}";
return $dsn;
}