2023-02-09 12:24:44 +00:00
|
|
|
import Metrics from '@overleaf/metrics'
|
2023-01-13 12:42:29 +00:00
|
|
|
import Settings from '@overleaf/settings'
|
2023-12-15 10:51:11 +00:00
|
|
|
import mongodb from 'mongodb-legacy'
|
|
|
|
const { MongoClient, ObjectId } = mongodb
|
2023-01-13 12:42:29 +00:00
|
|
|
|
2023-12-15 10:51:11 +00:00
|
|
|
export { ObjectId }
|
2023-01-13 12:42:29 +00:00
|
|
|
|
|
|
|
export const mongoClient = new MongoClient(Settings.mongo.url)
|
|
|
|
const mongoDb = mongoClient.db()
|
|
|
|
|
2023-02-09 12:24:44 +00:00
|
|
|
Metrics.mongodb.monitor(mongoClient)
|
|
|
|
|
2023-01-13 12:42:29 +00:00
|
|
|
export const db = {
|
|
|
|
deletedProjects: mongoDb.collection('deletedProjects'),
|
|
|
|
projects: mongoDb.collection('projects'),
|
|
|
|
projectHistoryFailures: mongoDb.collection('projectHistoryFailures'),
|
|
|
|
projectHistoryLabels: mongoDb.collection('projectHistoryLabels'),
|
|
|
|
projectHistorySyncState: mongoDb.collection('projectHistorySyncState'),
|
|
|
|
}
|