@brickyang/easy-mongodb
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -20,3 +20,2 @@ 'use strict'; | ||
this.client; | ||
this.featureCompatibilityVersion; | ||
} | ||
@@ -80,12 +79,4 @@ | ||
this.db = client.db(this.config.name); | ||
const { | ||
featureCompatibilityVersion, | ||
} = await this.db.executeDbAdminCommand({ | ||
getParameter: 1, | ||
featureCompatibilityVersion: 1, | ||
}); | ||
/* istanbul ignore next */ | ||
this.featureCompatibilityVersion = | ||
featureCompatibilityVersion.version || featureCompatibilityVersion; | ||
Object.freeze(this.db); | ||
Object.freeze(this.client); | ||
this.emit('connect'); | ||
@@ -640,8 +631,2 @@ return client; | ||
startSession(args = {}) { | ||
if (parseFloat(this.featureCompatibilityVersion) < 3.6) { | ||
throw new Error( | ||
'Current topology does not support sessions, need 3.6 or above' | ||
); | ||
} | ||
const options = Object.assign({}, args.options); | ||
@@ -663,8 +648,2 @@ return this.client.startSession(options); | ||
startTransaction(args = {}) { | ||
if (parseFloat(this.featureCompatibilityVersion) < 4) { | ||
throw new Error( | ||
'Current topology does not support transactions, need 4.0 or above' | ||
); | ||
} | ||
const options = Object.assign({}, args.options); | ||
@@ -671,0 +650,0 @@ const session = this.startSession(); |
{ | ||
"name": "@brickyang/easy-mongodb", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Based on MongoDB Native Node.js Driver.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
48489
793