2023-02-09 07:24:44 -05:00
|
|
|
import Metrics from '@overleaf/metrics'
|
2022-12-16 05:42:39 -05:00
|
|
|
import Settings from '@overleaf/settings'
|
|
|
|
import { MongoClient } from 'mongodb'
|
2020-08-21 11:30:18 -04:00
|
|
|
|
2022-12-16 05:42:39 -05:00
|
|
|
export { ObjectId } from 'mongodb'
|
2020-08-21 11:30:18 -04:00
|
|
|
|
2024-02-22 06:03:27 -05:00
|
|
|
export const mongoClient = new MongoClient(
|
|
|
|
Settings.mongo.url,
|
|
|
|
Settings.mongo.options
|
|
|
|
)
|
2022-12-16 05:42:39 -05:00
|
|
|
const mongoDb = mongoClient.db()
|
2020-08-21 11:30:18 -04:00
|
|
|
|
2022-12-16 05:42:39 -05:00
|
|
|
export const db = {
|
|
|
|
contacts: mongoDb.collection('contacts'),
|
2020-08-21 11:30:18 -04:00
|
|
|
}
|
2023-02-09 07:24:44 -05:00
|
|
|
|
|
|
|
Metrics.mongodb.monitor(mongoClient)
|