overleaf/services/chat/app/js/mongodb.js
2020-08-19 13:04:47 +01:00

15 lines
386 B
JavaScript

const Settings = require('settings-sharelatex')
const { MongoClient, ObjectId } = require('mongodb')
const clientConnecting = MongoClient.connect(Settings.mongo.url)
const dbPromise = clientConnecting.then((client) => client.db())
async function getCollection(name) {
return (await dbPromise).collection(name)
}
module.exports = {
clientConnecting,
ObjectId,
getCollection
}