Newer
Older
private static $db = null;
/**
* @return MongoDB\Database
*/
public static function getConnection()
if (Database::$db == null) {
$client = new MongoDB\Client("mongodb://localhost:27017");
Database::$db = $client->vpn;
if(Database::$db == null){
throw new Exception("Failed to connect to the database");
}
} else {
return Database::$db;