overleaf/services/project-history/app/js/mongodb.js
Eric Mc Sween 74eeec2ba3 Merge pull request #11680 from overleaf/em-mongo-pool-monitoring
Mongo connection pool monitoring

GitOrigin-RevId: 050e50e7e67061ccbf39a710ca4532eafd423365
2023-02-09 14:34:35 +00:00

18 lines
630 B
JavaScript

import Metrics from '@overleaf/metrics'
import Settings from '@overleaf/settings'
import { MongoClient } from 'mongodb'
export { ObjectId } from 'mongodb'
export const mongoClient = new MongoClient(Settings.mongo.url)
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'),
}