mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-20 07:50:56 +00: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:
parent
a096d98956
commit
370ee79a30
1 changed files with 14 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue