summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-16 20:59:31 +0100
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-16 20:59:31 +0100
commit7e25f67878a632529334f75677be76c474240a53 (patch)
tree753ac4e541cc5f98e179b88cbbdf2c8c0b3fca14
parent:bug: fix Message Model (diff)
downloadserver-7e25f67878a632529334f75677be76c474240a53.tar.xz
:bug: fix database
-rw-r--r--dist/util/Database.js4
-rw-r--r--dist/util/Database.js.map2
-rw-r--r--src/util/Database.ts7
3 files changed, 4 insertions, 9 deletions
diff --git a/dist/util/Database.js b/dist/util/Database.js
index 01b1b57c..cf992941 100644
--- a/dist/util/Database.js
+++ b/dist/util/Database.js
@@ -8,9 +8,7 @@ require("./MongoBigInt");
 const mongoose_1 = __importDefault(require("mongoose"));
 const mongodb_1 = require("mongodb");
 const events_1 = __importDefault(require("events"));
-const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPreference=secondaryPreferred";
-const connection = mongoose_1.default.createConnection(uri, { autoIndex: true });
-exports.default = connection;
+exports.default = mongoose_1.default.connection;
 class MongooseCache extends events_1.default {
     constructor(collection, pipeline, opts) {
         super();
diff --git a/dist/util/Database.js.map b/dist/util/Database.js.map
index 7dacb4cd..86a12a56 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,yBAAuB;AACvB,wDAA4D;AAC5D,qCAA0D;AAC1D,oDAAkC;AAClC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,sEAAsE,CAAC;AAE5G,MAAM,UAAU,GAAG,kBAAQ,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAEvE,kBAA2B,UAAU,CAAC;AAStC,MAAa,a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I,CAAC,OAAO,CAAC,CAAC;QAEnB,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;YAAE,OAAO;QAEnC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACD;AAxED,sCAwEC"}
\ No newline at end of file
diff --git a/src/util/Database.ts b/src/util/Database.ts
index 2304378c..1ebfbd12 100644
--- a/src/util/Database.ts
+++ b/src/util/Database.ts
@@ -1,12 +1,9 @@
 import "./MongoBigInt";
-import mongoose, { Collection, Connection } from "mongoose";
+import mongoose, { Collection } from "mongoose";
 import { ChangeStream, ChangeEvent, Long } from "mongodb";
 import EventEmitter from "events";
-const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPreference=secondaryPreferred";
 
-const connection = mongoose.createConnection(uri, { autoIndex: true });
-
-export default <Connection>connection;
+export default mongoose.connection;
 
 export interface MongooseCache {
 	on(event: "delete", listener: (id: string) => void): this;