Export new connection data

This commit is contained in:
Jonathan Barrow
2022-09-26 22:47:48 -04:00
parent 9f77a0054c
commit c4ec5aafd3

View File

@@ -9,10 +9,12 @@ const { uri, database, options } = config.mongoose;
let connection;
async function connect() {
await mongoose.connect(`${uri}/${database}`, options);
await mongoose.connect(`${uri}/${database}?replicaSet=rs0`, options);
connection = mongoose.connection;
connection.on('error', console.error.bind(console, 'connection error:'));
module.exports.connection = connection;
}
function verifyConnected() {