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

17 lines
348 B
JavaScript
Raw Normal View History

const Settings = require('@overleaf/settings')
2020-08-19 12:00:01 +00:00
const { MongoClient, ObjectId } = require('mongodb')
const client = new MongoClient(Settings.mongo.url)
const db = client.db()
2020-08-19 12:00:01 +00:00
const collections = {
messages: db.collection('messages'),
rooms: db.collection('rooms'),
}
2020-08-19 12:00:01 +00:00
module.exports = {
db: collections,
mongoClient: client,
2020-08-19 12:00:01 +00:00
ObjectId,
}