mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
1.0.0-preview
This commit is contained in:
1 parent
90b06d6aa7
commit
8cd84f29e8
18 files changed
+152
-401
No files matched your search
+3
-3
@@ -3,15 +3,15 @@ const bus = require('./bus');
|
||||
const options = require('../options');
|
||||
|
||||
let mongourl = 'mongodb://';
|
||||
if (options.db.username) mongourl += `${options.db.username}:${options.db.password}@`;
|
||||
mongourl += `${options.db.host}:${options.db.port}/${options.db.name}`;
|
||||
if (options.username) mongourl += `${options.username}:${options.password}@`;
|
||||
mongourl += `${options.host}:${options.port}/${options.name}`;
|
||||
/**
|
||||
* @type {import('mongodb').Db}
|
||||
*/
|
||||
let db = null;
|
||||
Mongo.MongoClient.connect(mongourl, { useNewUrlParser: true, useUnifiedTopology: true })
|
||||
.then((Database) => {
|
||||
db = Database.db(options.db.name);
|
||||
db = Database.db(options.name);
|
||||
db.Db = Database;
|
||||
bus.publish('system_database_connected', null);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user