mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
39ea30355e
Co-Authored-By: Eric Mc Sween <eric.mcsween@overleaf.com> Co-Authored-By: Miguel Serrano <mserranom@gmail.com> Co-Authored-By: Simon Detheridge <s@sd.ai>
19 lines
427 B
JavaScript
19 lines
427 B
JavaScript
const Settings = require('settings-sharelatex')
|
|
const { MongoClient, ObjectId } = require('mongodb')
|
|
|
|
const clientPromise = MongoClient.connect(Settings.mongo.url)
|
|
const dbPromise = clientPromise.then((client) => client.db())
|
|
|
|
async function getCollection(name) {
|
|
return (await dbPromise).collection(name)
|
|
}
|
|
|
|
async function waitForDb() {
|
|
await clientPromise
|
|
}
|
|
|
|
module.exports = {
|
|
ObjectId,
|
|
getCollection,
|
|
waitForDb
|
|
}
|