overleaf/services/chat/app/js/mongodb.js

16 lines
396 B
JavaScript
Raw Normal View History

import Metrics from '@overleaf/metrics'
import Settings from '@overleaf/settings'
import { MongoClient } from 'mongodb'
2020-08-19 08:00:01 -04:00
export { ObjectId } from 'mongodb'
2020-08-19 08:00:01 -04:00
export const mongoClient = new MongoClient(Settings.mongo.url)
const mongoDb = mongoClient.db()
export const db = {
messages: mongoDb.collection('messages'),
rooms: mongoDb.collection('rooms'),
2020-08-19 08:00:01 -04:00
}
Metrics.mongodb.monitor(mongoClient)