@notross/mongo-singleton
Version:
A lightweight, zero-fuss way to get a single shared MongoDB connection across your Node.js codebase.
13 lines • 533 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
require("dotenv/config");
const _1 = require(".");
const uri = process.env.MONGO_CONNECTION_STRING;
_1.mongoClient.init({ connection: uri, database: 'roc-sync' });
async function getUserByEmail(email) {
console.log(`Finding user with email ${email}`);
const user = await _1.mongoClient.collection('users').findOne({ email });
console.log(`⚡️ found user`, user);
}
getUserByEmail('rosslibbyatx@gmail.com');
//# sourceMappingURL=client.js.map
;