@bluedot-innovation/models 7.16.1 → 7.17.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "7.16.1",
3
+ "version": "7.17.0-alpha",
4
4
  "main": "Models.js",
5
5
  "scripts": {
6
6
  "lint": "./node_modules/.bin/eslint -c .eslintrc.js ./models/*.js ./__tests__/**/*.js ./__tests__/**/**/*.js ./schemas/*.js",
@@ -23,7 +23,7 @@
23
23
  "eslint-plugin-promise": "^3.6.0",
24
24
  "eslint-plugin-standard": "^3.0.1",
25
25
  "mocha": "^4.0.1",
26
- "mongodb": "^3.6.3",
26
+ "mongodb": "^5.1.0",
27
27
  "nyc": "^11.3.0",
28
28
  "prettier": "^1.13.5",
29
29
  "sinon": "^4.1.2"
@@ -37,7 +37,7 @@
37
37
  "deep-equal": "^1.0.1",
38
38
  "fast-deep-equal": "^2.0.1",
39
39
  "lodash.clonedeep": "4.5.0",
40
- "mongoose": "^5.11.4",
40
+ "mongoose": "^6.10.4",
41
41
  "uuid": "^3.1.0"
42
42
  }
43
43
  }
@@ -4,26 +4,27 @@ const {createAllIndexesIfNotExists} = require("./indexInitialiser");
4
4
  const MONGO_DB_URI = process.env.MONGO_DB_URI
5
5
  const DB_NAME = process.env.DB_NAME
6
6
  const ENVIRONMENT = process.env.ENVIRONMENT
7
- const client = new MongoClient(MONGO_DB_URI, { useUnifiedTopology: true })
7
+ const client = new MongoClient(MONGO_DB_URI)
8
8
 
9
9
  console.log(`Using DB_NAME:${DB_NAME} in ENVIRONMENT:${ENVIRONMENT}`)
10
10
 
11
- client.connect(async error => {
12
- if(error){
13
- console.log("Failed to connect to Mongo DB", error)
14
- process.exit(1)
15
- }
16
- console.log("Connected to Mongo DB")
11
+ try {
12
+ await client.connect()
13
+ } catch (error) {
14
+ console.log("Failed to connect to Mongo DB", error)
15
+ process.exit(1)
16
+ }
17
17
 
18
- const db = client.db(DB_NAME)
18
+ console.log("Connected to Mongo DB")
19
19
 
20
- try{
21
- await createAllIndexesIfNotExists(db)
22
- }catch(error){
23
- console.log(error)
24
- await client.close()
25
- process.exit(1)
26
- }
20
+ const db = client.db(DB_NAME)
27
21
 
22
+ try{
23
+ await createAllIndexesIfNotExists(db)
24
+ } catch(error) {
25
+ console.log(error)
28
26
  await client.close()
29
- })
27
+ process.exit(1)
28
+ }
29
+
30
+ await client.close()