@examgoal/mongodb
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -1,2 +0,2 @@ | ||
import { ClientSession, Db, MongoClient } from 'mongodb'; | ||
import { Db, MongoClient } from 'mongodb'; | ||
import { ConfigOptions } from "./lib/options"; | ||
@@ -7,3 +7,2 @@ declare class MongodbClient { | ||
constructor(config: ConfigOptions); | ||
createSession(): ClientSession; | ||
getDb(name?: string): Promise<Db>; | ||
@@ -10,0 +9,0 @@ get db(): Db; |
@@ -7,10 +7,5 @@ "use strict"; | ||
this.configuration = config; | ||
this.mongoClient = new mongodb_1.MongoClient(config.uri, Object.assign(Object.assign({}, (config.mongodbOptions || {})), { numberOfRetries: Number.MAX_VALUE, useNewUrlParser: true, useUnifiedTopology: true })); | ||
this.mongoClient = new mongodb_1.MongoClient(config.uri, config.mongodbOptions || {}); | ||
} | ||
createSession() { | ||
if (!this.isConnected) { | ||
throw new Error(`${this.name} Can't create session if client is not connected`); | ||
} | ||
return this.mongoClient.startSession(); | ||
} | ||
// If you are not using unifiedTopology use this line to connect | ||
getDb(name) { | ||
@@ -17,0 +12,0 @@ return new Promise((resolve, reject) => { |
{ | ||
"name": "@examgoal/mongodb", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "MongoDB Session Management Helper for ExpressJS or any Node JS Projects", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3202
72