diff --git a/services/docstore/app/js/mongodb.js b/services/docstore/app/js/mongodb.js index bbecd6501d..e9c425ad95 100644 --- a/services/docstore/app/js/mongodb.js +++ b/services/docstore/app/js/mongodb.js @@ -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 }