@neoxr/wb 2.1.0-dev → 2.1.1

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/system/mongo.js +3 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name":"@neoxr/wb",
3
- "version":"2.1.0-dev",
3
+ "version":"2.1.1",
4
4
  "description":"Simplicity WhatsApp Bot (Baileys)",
5
5
  "main":"index.js",
6
6
  "scripts":{
@@ -45,7 +45,7 @@
45
45
  "jimp":"^0.16.1",
46
46
  "mime-types":"~2.1.32",
47
47
  "miniget": "^4.2.3",
48
- "mongodb":"4.x",
48
+ "mongodb":"4.9.0",
49
49
  "mongoose":"5.10.8",
50
50
  "moment-timezone":"~0.5.34",
51
51
  "node-cache":"^5.1.2",
package/system/mongo.js CHANGED
@@ -9,18 +9,14 @@ module.exports = class MongoDB {
9
9
  this.db = db || 'database'
10
10
  this.options = options
11
11
  this.client = null
12
- this.connection()
13
12
  this.init()
14
13
  }
15
14
 
16
- connection = () => {
17
- this.client = new MongoClient(process.env.DATABASE_URL, this.options)
18
- this.client.connect()
19
- }
15
+ client = new MongoClient(process.env.DATABASE_URL, this.options)
20
16
 
21
17
  exec = async (collect) => {
22
18
  try {
23
- // await this.client.connect()
19
+ await this.client.connect()
24
20
  const db = await this.client.db(this.db).collection(collect)
25
21
  return db
26
22
  } catch (e) {
@@ -77,7 +73,7 @@ module.exports = class MongoDB {
77
73
 
78
74
  init = async () => {
79
75
  try {
80
- // await this.client.connect()
76
+ await this.client.connect()
81
77
  const db = await this.client.db(this.db)
82
78
  const data = await (await db.listCollections().toArray()).some(v => v.name == 'data')
83
79
  if (!data) db.createCollection('data')