senter-mongo-repository
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -1,15 +0,18 @@ | ||
const MongoClient = require('mongodb').MongoClient; | ||
const uuidv4 = require('uuid/v4'); | ||
const MongoClient = require('mongodb').MongoClient | ||
const uuidv4 = require('uuid/v4') | ||
const options = { | ||
useUnifiedTopology: true, | ||
useNewUrlParser: true | ||
}; | ||
useNewUrlParser: true, | ||
useFindAndModify: false, | ||
useCreateIndex: true, | ||
} | ||
class MongoReposotory { | ||
constructor(connectionString, dbName, collectionName,) { | ||
this.dbName = dbName; | ||
this.collectionName = collectionName; | ||
this.client = new MongoClient(connectionString, options); | ||
this.isConnected = false; | ||
this.dbName = dbName | ||
this.collectionName = collectionName | ||
this.client = new MongoClient(connectionString, options) | ||
this.isConnected = false | ||
} | ||
@@ -19,4 +22,4 @@ | ||
if (!this.isConnected) { | ||
await this.client.connect(); | ||
this.isConnected = true; | ||
await this.client.connect() | ||
this.isConnected = true | ||
} | ||
@@ -27,4 +30,4 @@ } | ||
if (this.isConnected) { | ||
await this.client.close(); | ||
this.isConnected = false; | ||
await this.client.close() | ||
this.isConnected = false | ||
} | ||
@@ -31,0 +34,0 @@ } |
{ | ||
"name": "senter-mongo-repository", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "Contain methods to work with mongo db", | ||
@@ -12,3 +12,3 @@ "main": "mongoReposotory.js", | ||
"dependencies": { | ||
"mongodb": "^3.5.7", | ||
"mongodb": "^3.6.11", | ||
"uuid": "^3.4.0" | ||
@@ -15,0 +15,0 @@ }, |
33295
898
Updatedmongodb@^3.6.11