Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@examgoal/mongodb

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@examgoal/mongodb - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

2

dist/index.d.ts

@@ -7,4 +7,4 @@ import { ClientSession, Db, MongoClient } from 'mongodb';

constructor(config: ConfigOptions);
connect(): Promise<MongodbClient>;
createSession(): ClientSession;
getDb(name?: string): Promise<Db>;
readonly db: Db;

@@ -11,0 +11,0 @@ readonly isConnected: boolean;

@@ -7,17 +7,4 @@ "use strict";

this.configuration = config;
this.mongoClient = new mongodb_1.MongoClient(config.uri, Object.assign(Object.assign({}, (config.mongodbOptions || {})), { useNewUrlParser: true }));
this.mongoClient = new mongodb_1.MongoClient(config.uri, Object.assign(Object.assign({}, (config.mongodbOptions || {})), { numberOfRetries: Number.MAX_VALUE, useNewUrlParser: true, useUnifiedTopology: true }));
}
connect() {
return new Promise((resolve, reject) => {
this.mongoClient.connect((err) => {
if (err) {
return reject(err);
}
if (this.configuration.logEnabled) {
console.log(`${this.name} App's MongoDB Connected`);
}
return resolve(instances[this.name]);
});
});
}
createSession() {

@@ -29,2 +16,12 @@ if (!this.isConnected) {

}
getDb(name) {
return new Promise((resolve, reject) => {
if (this.isConnected) {
return resolve(this.mongoClient.db(name || this.configuration.db));
}
this.mongoClient.connect()
.then(res => resolve(res.db(name || this.configuration.db)))
.catch(reject);
});
}
get db() {

@@ -43,7 +40,3 @@ return this.mongoClient.db(this.configuration.db);

static initializeApp(config) {
let a = new MongodbClient(config);
instances[config.name || '[DEFAULT]'] = a;
a.connect().catch(err => {
throw new Error(`${a.name} MongoDB App\'s Error Occurred on first initialization : Error = ${err.toString()}`);
});
instances[config.name || '[DEFAULT]'] = new MongodbClient(config);
}

@@ -50,0 +43,0 @@ static getInstance(name) {

{
"name": "@examgoal/mongodb",
"version": "1.0.6",
"version": "1.0.7",
"description": "MongoDB Session Management Helper for ExpressJS or any Node JS Projects",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc