diff --git a/dist/util/Database.js b/dist/util/Database.js index 9fe58f0a..9ac6eeeb 100644 --- a/dist/util/Database.js +++ b/dist/util/Database.js @@ -2,6 +2,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); const lambert_db_1 = require("lambert-db"); // TODO: load url from config -const db = new lambert_db_1.MongoDatabase("mongodb://127.0.0.1:27017/lambert?readPreference=secondaryPreferred"); +const db = new lambert_db_1.MongoDatabase("mongodb://127.0.0.1:27017/lambert?readPreference=secondaryPreferred", { + useNewUrlParser: true, + useUnifiedTopology: false, +}); exports.default = db; //# sourceMappingURL=Database.js.map \ No newline at end of file diff --git a/dist/util/Database.js.map b/dist/util/Database.js.map index 11227ca7..f7157bb6 100644 --- a/dist/util/Database.js.map +++ b/dist/util/Database.js.map @@ -1 +1 @@ -{"version":3,"file":"Database.js","sourceRoot":"","sources":["../../src/util/Database.ts"],"names":[],"mappings":";;AAAA,2CAA2C;AAE3C,6BAA6B;AAC7B,MAAM,EAAE,GAAG,IAAI,0BAAa,CAAC,qEAAqE,CAAC,CAAC;AAEpG,kBAAe,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"Database.js","sourceRoot":"","sources":["../../src/util/Database.ts"],"names":[],"mappings":";;AAAA,2CAA2C;AAE3C,6BAA6B;AAC7B,MAAM,EAAE,GAAG,IAAI,0BAAa,CAAC,qEAAqE,EAAE;IACnG,eAAe,EAAE,IAAI;IACrB,kBAAkB,EAAE,KAAK;CACzB,CAAC,CAAC;AAEH,kBAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d6ae8069..00d1e0a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": { "jsonwebtoken": "^8.5.1", - "lambert-db": "^1.1.6", + "lambert-db": "^1.1.7", "missing-native-js-functions": "^1.2.2" }, "devDependencies": { @@ -418,9 +418,9 @@ "integrity": "sha512-STHz9P7X2L4Kwn72fA4rGyqyXdmrMSdxqHx9IXon/FXluXieaFA6KJ2upcHAHxQPQ0LeM/OjLrhFxifHewOALQ==" }, "node_modules/lambert-db": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/lambert-db/-/lambert-db-1.1.6.tgz", - "integrity": "sha512-FbUNAbgPYUvfJSxLdcfIk6w8J+Z4IYZJasVURBMm4eOeLm//kgGeOi+SrJqqa5z+gaCJ65ENIVs2hd+Cj2Efbw==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/lambert-db/-/lambert-db-1.1.7.tgz", + "integrity": "sha512-OJzXySr/eISttGbkB3uE4ybJW8H/eO1lKWzCt0R38OBuMKnVBfCDO3yOQCXiIzjk9kXOggL4vsKy3OujLDXoDg==", "dependencies": { "missing-native-js-functions": "^1.1.8", "mongodb": "^3.6.2", @@ -1428,9 +1428,9 @@ "integrity": "sha512-STHz9P7X2L4Kwn72fA4rGyqyXdmrMSdxqHx9IXon/FXluXieaFA6KJ2upcHAHxQPQ0LeM/OjLrhFxifHewOALQ==" }, "lambert-db": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/lambert-db/-/lambert-db-1.1.6.tgz", - "integrity": "sha512-FbUNAbgPYUvfJSxLdcfIk6w8J+Z4IYZJasVURBMm4eOeLm//kgGeOi+SrJqqa5z+gaCJ65ENIVs2hd+Cj2Efbw==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/lambert-db/-/lambert-db-1.1.7.tgz", + "integrity": "sha512-OJzXySr/eISttGbkB3uE4ybJW8H/eO1lKWzCt0R38OBuMKnVBfCDO3yOQCXiIzjk9kXOggL4vsKy3OujLDXoDg==", "requires": { "missing-native-js-functions": "^1.1.8", "mongodb": "^3.6.2", diff --git a/package.json b/package.json index e42419d5..94d77010 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "homepage": "https://github.com/discord-open-source/discord-server-util#readme", "dependencies": { "jsonwebtoken": "^8.5.1", - "lambert-db": "^1.1.6", + "lambert-db": "^1.1.7", "missing-native-js-functions": "^1.2.2" }, "devDependencies": { diff --git a/src/util/Config.ts b/src/util/Config.ts index b22e88e0..5886b268 100644 --- a/src/util/Config.ts +++ b/src/util/Config.ts @@ -5,7 +5,7 @@ var Config: ProviderCache; export default { init: async function init(opts: DefaultOptions = DefaultOptions) { - Config = db.data.config({}).cache(); + Config = await db.data.config({}).cache(); await Config.init(); await Config.set(opts.merge(Config.cache || {})); }, diff --git a/src/util/Database.ts b/src/util/Database.ts index d842ac6b..ed45a9ad 100644 --- a/src/util/Database.ts +++ b/src/util/Database.ts @@ -1,6 +1,9 @@ import { MongoDatabase } from "lambert-db"; // TODO: load url from config -const db = new MongoDatabase("mongodb://127.0.0.1:27017/lambert?readPreference=secondaryPreferred"); +const db = new MongoDatabase("mongodb://127.0.0.1:27017/lambert?readPreference=secondaryPreferred", { + useNewUrlParser: true, + useUnifiedTopology: false, +}); export default db;