mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 05:41:33 +02:00
Merge pull request #3200 from overleaf/jpa-mongodb-native-migrations
[misc] migrate the migrations to the latest native mongo driver GitOrigin-RevId: eedfa71571910adf7cc205a1f69e27492fe80883
This commit is contained in:
@@ -70,9 +70,23 @@ async function setupDb() {
|
||||
db.users = internalDb.collection('users')
|
||||
db.userstubs = internalDb.collection('userstubs')
|
||||
}
|
||||
async function addCollection(name) {
|
||||
await waitForDb()
|
||||
const internalDb = (await clientPromise).db()
|
||||
|
||||
db[name] = internalDb.collection(name)
|
||||
}
|
||||
async function getCollectionNames() {
|
||||
const internalDb = (await clientPromise).db()
|
||||
|
||||
const collections = await internalDb.collections()
|
||||
return collections.map(collection => collection.collectionName)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
db,
|
||||
ObjectId,
|
||||
addCollection,
|
||||
getCollectionNames,
|
||||
waitForDb
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user