mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 02:00:10 +02:00
30 lines
598 B
JavaScript
30 lines
598 B
JavaScript
// @ts-check
|
|
|
|
import Metrics from '@overleaf/metrics'
|
|
|
|
import Settings from '@overleaf/settings'
|
|
import MongoUtils from '@overleaf/mongo-utils'
|
|
import mongodb from 'mongodb-legacy'
|
|
|
|
const { MongoClient, ObjectId } = mongodb
|
|
|
|
const mongoClient = new MongoClient(Settings.mongo.url, Settings.mongo.options)
|
|
const mongoDb = mongoClient.db()
|
|
|
|
const db = {
|
|
docs: mongoDb.collection('docs'),
|
|
}
|
|
|
|
Metrics.mongodb.monitor(mongoClient)
|
|
|
|
async function cleanupTestDatabase() {
|
|
await MongoUtils.cleanupTestDatabase(mongoClient)
|
|
}
|
|
|
|
export default {
|
|
db,
|
|
mongoClient,
|
|
ObjectId,
|
|
cleanupTestDatabase,
|
|
}
|