mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
b59326e96f
Use mongo command monitoring to add timing metrics GitOrigin-RevId: e7e5dd5cca1ba3802c02198ccf81058d4da3f1e7
22 lines
686 B
JavaScript
22 lines
686 B
JavaScript
import Metrics from '@overleaf/metrics'
|
|
import Settings from '@overleaf/settings'
|
|
import mongodb from 'mongodb-legacy'
|
|
const { MongoClient, ObjectId } = mongodb
|
|
|
|
export { ObjectId }
|
|
|
|
export const mongoClient = new MongoClient(
|
|
Settings.mongo.url,
|
|
Settings.mongo.options
|
|
)
|
|
const mongoDb = mongoClient.db()
|
|
|
|
Metrics.mongodb.monitor(mongoClient)
|
|
|
|
export const db = {
|
|
deletedProjects: mongoDb.collection('deletedProjects'),
|
|
projects: mongoDb.collection('projects'),
|
|
projectHistoryFailures: mongoDb.collection('projectHistoryFailures'),
|
|
projectHistoryLabels: mongoDb.collection('projectHistoryLabels'),
|
|
projectHistorySyncState: mongoDb.collection('projectHistorySyncState'),
|
|
}
|