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