cubeforall-dbconnection
Version:
A centralized MongoDB connection handler with connection pooling and graceful shutdown support.
16 lines (15 loc) • 422 B
JavaScript
const { connectMongoDB, getDatabase, getCollection, getClient, closeAllConnections, getMongoDBStatus } = require("./mongodb");
const { ObjectId, GridFSBucket, Timestamp, Binary } = require("mongodb");
module.exports = {
connectMongoDB,
getDatabase,
getCollection,
getClient,
closeAllConnections,
getMongoDBStatus,
// Expose commonly used MongoDB classes
ObjectId,
GridFSBucket,
Timestamp,
Binary,
};