overleaf/services/contacts/app/js/mongodb.js
David b59326e96f Merge pull request #16873 from overleaf/dp-mongo-command-monitoring
Use mongo command monitoring to add timing metrics

GitOrigin-RevId: e7e5dd5cca1ba3802c02198ccf81058d4da3f1e7
2024-02-23 09:02:55 +00:00

17 lines
388 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,
Settings.mongo.options
)
const mongoDb = mongoClient.db()
export const db = {
contacts: mongoDb.collection('contacts'),
}
Metrics.mongodb.monitor(mongoClient)