2023-03-05 17:18:43 +00:00
|
|
|
import winston from "winston"
|
|
|
|
import mongoose from "mongoose";
|
|
|
|
import config from "../config/config.mjs";
|
2015-08-05 00:41:43 +00:00
|
|
|
|
2023-03-05 13:07:36 +00:00
|
|
|
mongoose.set('strictQuery', true);
|
|
|
|
|
2015-10-01 10:21:59 +00:00
|
|
|
var connect = function () {
|
2020-10-11 17:47:33 +00:00
|
|
|
mongoose.connect(config.mongo.uri, {
|
|
|
|
useNewUrlParser: true,
|
|
|
|
useUnifiedTopology: true
|
|
|
|
}).then(
|
|
|
|
() => winston.info("MongoDB: Connection established"),
|
|
|
|
error => winston.error(error)
|
|
|
|
);
|
2015-10-01 10:21:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
connect();
|
|
|
|
|
2020-10-11 17:47:33 +00:00
|
|
|
mongoose.connection.on("error", (error) => winston.error(error));
|
|
|
|
mongoose.connection.on("disconnected", () => winston.error("MongoDB: Was disconnected."));
|
|
|
|
mongoose.connection.on("reconnectFailed", () => winston.error("MongoDB: Reconnect Failed!"));
|
2015-10-01 10:21:59 +00:00
|
|
|
|
2020-10-11 17:47:33 +00:00
|
|
|
mongoose.connection.on("reconnected", () => winston.info("MongoDB: Connection established"));
|
2015-08-05 00:41:43 +00:00
|
|
|
|
2023-03-05 17:18:43 +00:00
|
|
|
// Load Models
|
|
|
|
import "./models/event.mjs";
|
|
|
|
import "./models/message.mjs";
|
|
|
|
import "./models/session.mjs";
|
|
|
|
import "./models/profile.mjs";
|
|
|
|
import "./models/archivedGather.mjs";
|