2023-02-09 07:24:44 -05:00
|
|
|
const Metrics = require('@overleaf/metrics')
|
2021-07-12 12:47:20 -04:00
|
|
|
const Settings = require('@overleaf/settings')
|
2023-12-13 04:38:54 -05:00
|
|
|
const { MongoClient, ObjectId } = require('mongodb-legacy')
|
2020-08-21 12:50:01 -04:00
|
|
|
|
2022-12-15 07:53:03 -05:00
|
|
|
const mongoClient = new MongoClient(Settings.mongo.url)
|
|
|
|
const mongoDb = mongoClient.db()
|
2020-08-21 12:50:01 -04:00
|
|
|
|
2022-12-15 07:53:03 -05:00
|
|
|
const db = {
|
|
|
|
docs: mongoDb.collection('docs'),
|
2020-09-07 04:44:19 -04:00
|
|
|
}
|
2020-08-28 08:13:19 -04:00
|
|
|
|
2023-02-09 07:24:44 -05:00
|
|
|
Metrics.mongodb.monitor(mongoClient)
|
|
|
|
|
2020-08-21 12:50:01 -04:00
|
|
|
module.exports = {
|
2020-08-28 08:13:19 -04:00
|
|
|
db,
|
2022-12-15 07:53:03 -05:00
|
|
|
mongoClient,
|
2020-08-21 12:50:01 -04:00
|
|
|
ObjectId,
|
|
|
|
}
|