mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-16 20:12:02 +00:00
[misc] mongodb: export a helper for adding new collections to db
Co-Authored-By: Eric Mc Sween <eric.mcsween@overleaf.com> Co-Authored-By: Simon Detheridge <s@sd.ai>
This commit is contained in:
parent
1e7fa2246d
commit
54a82b8c62
1 changed files with 7 additions and 0 deletions
|
@ -18,9 +18,16 @@ async function setupDb() {
|
|||
db.docs = internalDb.collection('docs')
|
||||
db.docOps = internalDb.collection('docOps')
|
||||
}
|
||||
async function addCollection(name) {
|
||||
await waitForDb()
|
||||
const internalDb = (await clientPromise).db()
|
||||
|
||||
db[name] = internalDb.collection(name)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
db,
|
||||
ObjectId,
|
||||
addCollection,
|
||||
waitForDb
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue