@tomsd/mongodbclient 2.7.1 → 2.7.2

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.
@@ -31,7 +31,7 @@ export declare class MClient {
31
31
  stats(): Promise<unknown>;
32
32
  count(condition?: any): Promise<number>;
33
33
  insertMany(items: any[]): Promise<unknown>;
34
- dbStats(): Promise<unknown>;
34
+ dbStats(): Promise<any>;
35
35
  getCollections(): Promise<any>;
36
36
  }
37
37
  export default MClient;
@@ -191,20 +191,17 @@ class MClient {
191
191
  });
192
192
  }
193
193
  dbStats() {
194
- const that = this;
195
- return new Promise(function (resolve, reject) {
196
- that.getConnected()
197
- .then(function (conn) {
198
- conn.db.stats()
199
- .then(function (r) {
200
- conn.client.close();
201
- resolve(r);
202
- })
203
- .catch(function (e) {
204
- conn.client.close();
205
- reject(e);
206
- });
207
- }, reject);
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ const connection = yield this.getConnected();
196
+ try {
197
+ return yield connection.db.stats();
198
+ }
199
+ catch (e) {
200
+ throw e;
201
+ }
202
+ finally {
203
+ connection.client.close();
204
+ }
208
205
  });
209
206
  }
210
207
  getCollections() {
@@ -31,7 +31,7 @@ export declare class MClient {
31
31
  stats(): Promise<unknown>;
32
32
  count(condition?: any): Promise<number>;
33
33
  insertMany(items: any[]): Promise<unknown>;
34
- dbStats(): Promise<unknown>;
34
+ dbStats(): Promise<any>;
35
35
  getCollections(): Promise<any>;
36
36
  }
37
37
  export default MClient;
@@ -187,20 +187,17 @@ export class MClient {
187
187
  });
188
188
  }
189
189
  dbStats() {
190
- const that = this;
191
- return new Promise(function (resolve, reject) {
192
- that.getConnected()
193
- .then(function (conn) {
194
- conn.db.stats()
195
- .then(function (r) {
196
- conn.client.close();
197
- resolve(r);
198
- })
199
- .catch(function (e) {
200
- conn.client.close();
201
- reject(e);
202
- });
203
- }, reject);
190
+ return __awaiter(this, void 0, void 0, function* () {
191
+ const connection = yield this.getConnected();
192
+ try {
193
+ return yield connection.db.stats();
194
+ }
195
+ catch (e) {
196
+ throw e;
197
+ }
198
+ finally {
199
+ connection.client.close();
200
+ }
204
201
  });
205
202
  }
206
203
  getCollections() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomsd/mongodbclient",
3
- "version": "2.7.1",
3
+ "version": "2.7.2",
4
4
  "description": "",
5
5
  "main": "dist/cjs/mongodbclient.js",
6
6
  "module": "dist/esm/mongodbclient.js",