UNPKG

@notross/mongo-singleton

Version:

A lightweight, zero-fuss way to get a single shared MongoDB connection across your Node.js codebase.

34 lines 1.73 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.useClient = exports.MongoSingleton = exports.mongoClient = exports.getDb = exports.db = exports.configure = exports.collection = void 0; const mongo_singleton_1 = require("./mongo-singleton"); Object.defineProperty(exports, "MongoSingleton", { enumerable: true, get: function () { return mongo_singleton_1.MongoSingleton; } }); const clients_1 = require("./clients"); Object.defineProperty(exports, "useClient", { enumerable: true, get: function () { return clients_1.useClient; } }); const mongoClient = new mongo_singleton_1.MongoSingleton(); exports.mongoClient = mongoClient; const db = mongoClient.db; exports.db = db; const getDb = mongoClient.connectedDb; exports.getDb = getDb; const collection = mongoClient.collection; exports.collection = collection; const configure = mongoClient.configure; exports.configure = configure; exports.default = mongo_singleton_1.MongoSingleton; __exportStar(require("./types"), exports); //# sourceMappingURL=index.js.map