@tomsd/mongodbclient 2.4.0 → 2.5.0

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.
@@ -26,7 +26,7 @@ export declare class MClient {
26
26
  protected getConnected(): Promise<MongoConnection>;
27
27
  upsert(pobj: any): Promise<unknown>;
28
28
  read(condition?: any, opt?: any): Promise<unknown>;
29
- distinct(key: string, condition: any): Promise<unknown>;
29
+ distinct(key: string, condition?: any): Promise<unknown>;
30
30
  remove(condition: any): Promise<unknown>;
31
31
  stats(): Promise<unknown>;
32
32
  count(condition: any): Promise<number>;
@@ -96,7 +96,7 @@ class MClient {
96
96
  });
97
97
  });
98
98
  }
99
- distinct(key, condition) {
99
+ distinct(key, condition = {}) {
100
100
  const that = this;
101
101
  return new Promise(function (resolve, reject) {
102
102
  that.getConnected()
@@ -26,7 +26,7 @@ export declare class MClient {
26
26
  protected getConnected(): Promise<MongoConnection>;
27
27
  upsert(pobj: any): Promise<unknown>;
28
28
  read(condition?: any, opt?: any): Promise<unknown>;
29
- distinct(key: string, condition: any): Promise<unknown>;
29
+ distinct(key: string, condition?: any): Promise<unknown>;
30
30
  remove(condition: any): Promise<unknown>;
31
31
  stats(): Promise<unknown>;
32
32
  count(condition: any): Promise<number>;
@@ -92,7 +92,7 @@ export class MClient {
92
92
  });
93
93
  });
94
94
  }
95
- distinct(key, condition) {
95
+ distinct(key, condition = {}) {
96
96
  const that = this;
97
97
  return new Promise(function (resolve, reject) {
98
98
  that.getConnected()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomsd/mongodbclient",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "",
5
5
  "main": "dist/cjs/mongodbclient.js",
6
6
  "module": "dist/esm/mongodbclient.js",
package/test/test.ts CHANGED
@@ -43,7 +43,7 @@ describe("MClient", () => {
43
43
  });
44
44
 
45
45
  it("distinct()", async () => {
46
- const names = (await mdbc.distinct("name", {})) as string[];
46
+ const names = (await mdbc.distinct("name")) as string[];
47
47
  assert.equal(names.length, 4);
48
48
  });
49
49