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