overleaf/services/notifications/app/js/mongodb.js
Jakob Ackermann d77834ab55 [misc] migrate the app to the native mongo driver
health-check to follow in a separate commit
2020-09-07 11:27:59 +01:00

21 lines
434 B
JavaScript

const Settings = require('settings-sharelatex')
const { MongoClient, ObjectId } = require('mongodb')
const clientPromise = MongoClient.connect(Settings.mongo.url)
async function waitForDb() {
await clientPromise
}
const db = {}
waitForDb().then(async function () {
const internalDb = (await clientPromise).db()
db.notifications = internalDb.collection('notifications')
})
module.exports = {
db,
ObjectId,
waitForDb
}