overleaf/services/history-v1/storage/lib/mongodb.js
Eric Mc Sween 74eeec2ba3 Merge pull request #11680 from overleaf/em-mongo-pool-monitoring
Mongo connection pool monitoring

GitOrigin-RevId: 050e50e7e67061ccbf39a710ca4532eafd423365
2023-02-09 14:34:35 +00:00

16 lines
536 B
JavaScript

const Metrics = require('@overleaf/metrics')
const config = require('config')
const { MongoClient } = require('mongodb')
const client = new MongoClient(config.mongo.uri)
const db = client.db()
const chunks = db.collection('projectHistoryChunks')
const blobs = db.collection('projectHistoryBlobs')
const globalBlobs = db.collection('projectHistoryGlobalBlobs')
const shardedBlobs = db.collection('projectHistoryShardedBlobs')
Metrics.mongodb.monitor(client)
module.exports = { client, db, chunks, blobs, globalBlobs, shardedBlobs }