@tomsd/mongodbclient 2.7.2 → 2.7.3

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.
@@ -22,8 +22,8 @@ export declare class MClient {
22
22
  get uri(): string;
23
23
  get db(): string;
24
24
  get collection(): string;
25
- connect(): Promise<MongoConnection>;
26
- protected getConnected(): Promise<MongoConnection>;
25
+ connect(): Promise<any>;
26
+ protected getConnected(): Promise<any>;
27
27
  upsert(pobj: any): Promise<unknown>;
28
28
  read(condition?: any, opt?: any): Promise<unknown>;
29
29
  distinct(key: string, condition?: any): Promise<unknown>;
@@ -55,17 +55,14 @@ class MClient {
55
55
  return this.getConnected();
56
56
  }
57
57
  getConnected() {
58
- const that = this;
59
- const client = new MongoClient(that.m_uri, { useUnifiedTopology: true });
60
- return new Promise(function (resolve, reject) {
61
- client.connect()
62
- .then(function (client) {
63
- const db = client.db(that.m_db);
64
- const collection = db.collection(that.m_collection);
65
- resolve(new MongoConnection(client, db, collection));
66
- })
67
- .catch(function (e) {
68
- reject(e);
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const client = new MongoClient(this.m_uri, { useUnifiedTopology: true });
60
+ return client
61
+ .connect()
62
+ .then((client) => {
63
+ const db = client.db(this.m_db);
64
+ const collection = db.collection(this.m_collection);
65
+ return new MongoConnection(client, db, collection);
69
66
  });
70
67
  });
71
68
  }
@@ -22,8 +22,8 @@ export declare class MClient {
22
22
  get uri(): string;
23
23
  get db(): string;
24
24
  get collection(): string;
25
- connect(): Promise<MongoConnection>;
26
- protected getConnected(): Promise<MongoConnection>;
25
+ connect(): Promise<any>;
26
+ protected getConnected(): Promise<any>;
27
27
  upsert(pobj: any): Promise<unknown>;
28
28
  read(condition?: any, opt?: any): Promise<unknown>;
29
29
  distinct(key: string, condition?: any): Promise<unknown>;
@@ -51,17 +51,14 @@ export class MClient {
51
51
  return this.getConnected();
52
52
  }
53
53
  getConnected() {
54
- const that = this;
55
- const client = new MongoClient(that.m_uri, { useUnifiedTopology: true });
56
- return new Promise(function (resolve, reject) {
57
- client.connect()
58
- .then(function (client) {
59
- const db = client.db(that.m_db);
60
- const collection = db.collection(that.m_collection);
61
- resolve(new MongoConnection(client, db, collection));
62
- })
63
- .catch(function (e) {
64
- reject(e);
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const client = new MongoClient(this.m_uri, { useUnifiedTopology: true });
56
+ return client
57
+ .connect()
58
+ .then((client) => {
59
+ const db = client.db(this.m_db);
60
+ const collection = db.collection(this.m_collection);
61
+ return new MongoConnection(client, db, collection);
65
62
  });
66
63
  });
67
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomsd/mongodbclient",
3
- "version": "2.7.2",
3
+ "version": "2.7.3",
4
4
  "description": "",
5
5
  "main": "dist/cjs/mongodbclient.js",
6
6
  "module": "dist/esm/mongodbclient.js",