Getting mongo working

This commit is contained in:
wess
2022-11-02 14:39:36 -04:00
parent e0a1cdb886
commit 5763a3901a
7 changed files with 64 additions and 72 deletions
+5 -19
View File
@@ -64,8 +64,7 @@ use Swoole\Database\PDOConfig;
use Swoole\Database\PDOPool;
use Swoole\Database\RedisConfig;
use Swoole\Database\RedisPool;
use Utopia\Mongo\MongoClient;
use Utopia\Mongo\MongoClientOptions;
use Utopia\Mongo\Client;
use Utopia\Database\Adapter\Mongo;
use Utopia\Database\Query;
use Utopia\Database\Validator\DatetimeValidator;
@@ -510,16 +509,11 @@ $register->set('dbPool', function () {
$dbPass = App::getEnv('_APP_DB_PASS', '');
$dbScheme = App::getEnv('_APP_DB_SCHEMA', '');
$options = new MongoClientOptions(
name: $dbScheme,
host: $dbHost,
port: (int) $dbPort,
username: $dbUser,
password: $dbPass
$pool = new ConnectionPool(constructor: fn () =>
new Client($dbScheme, $dbHost, (int) $dbPort, $dbUser, $dbPass, true),
size: 64
);
$pool = new ConnectionPool(constructor: fn () => new MongoClient($options, true), size: 64);
return $pool;
});
$register->set('redisPool', function () {
@@ -607,15 +601,7 @@ $register->set('db', function () {
$dbPass = App::getEnv('_APP_DB_PASS', '');
$dbScheme = App::getEnv('_APP_DB_SCHEMA', '');
$options = new MongoClientOptions(
name: $dbScheme,
host: $dbHost,
port: (int) $dbPort,
username: $dbUser,
password: $dbPass
);
$client = new MongoClient($options, false);
$client = new Client($dbScheme, $dbHost, (int) $dbPort, $dbUser, $dbPass, true);
return $client;
});