2023-02-09 12:24:44 +00:00
|
|
|
import Metrics from '@overleaf/metrics'
|
2022-12-13 12:37:49 +00:00
|
|
|
import Settings from '@overleaf/settings'
|
|
|
|
import { MongoClient } from 'mongodb'
|
2020-08-19 12:00:01 +00:00
|
|
|
|
2022-12-13 12:37:49 +00:00
|
|
|
export { ObjectId } from 'mongodb'
|
2020-08-19 12:00:01 +00:00
|
|
|
|
2022-12-13 12:37:49 +00:00
|
|
|
export const mongoClient = new MongoClient(Settings.mongo.url)
|
|
|
|
const mongoDb = mongoClient.db()
|
2020-08-27 15:31:27 +00:00
|
|
|
|
2022-12-13 12:37:49 +00:00
|
|
|
export const db = {
|
|
|
|
messages: mongoDb.collection('messages'),
|
|
|
|
rooms: mongoDb.collection('rooms'),
|
2020-08-19 12:00:01 +00:00
|
|
|
}
|
2023-02-09 12:24:44 +00:00
|
|
|
|
|
|
|
Metrics.mongodb.monitor(mongoClient)
|