@tomsd/mongodbclient 2.7.6 → 2.7.7
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<any>;
|
|
27
27
|
upsert(pobj: any): Promise<any>;
|
|
28
28
|
read(condition?: any, opt?: any): Promise<any>;
|
|
29
|
-
distinct(key: string, condition?: any): Promise<
|
|
29
|
+
distinct(key: string, condition?: any): Promise<any>;
|
|
30
30
|
remove(condition: any): Promise<unknown>;
|
|
31
31
|
stats(): Promise<any>;
|
|
32
32
|
count(condition?: any): Promise<number>;
|
|
@@ -99,20 +99,17 @@ class MClient {
|
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
distinct(key, condition = {}) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
reject(e);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
const connection = yield this.getConnected();
|
|
104
|
+
try {
|
|
105
|
+
return yield connection.collection.distinct(key, condition);
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
throw e;
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
connection.client.close();
|
|
112
|
+
}
|
|
116
113
|
});
|
|
117
114
|
}
|
|
118
115
|
remove(condition) {
|
|
@@ -26,7 +26,7 @@ export declare class MClient {
|
|
|
26
26
|
protected getConnected(): Promise<any>;
|
|
27
27
|
upsert(pobj: any): Promise<any>;
|
|
28
28
|
read(condition?: any, opt?: any): Promise<any>;
|
|
29
|
-
distinct(key: string, condition?: any): Promise<
|
|
29
|
+
distinct(key: string, condition?: any): Promise<any>;
|
|
30
30
|
remove(condition: any): Promise<unknown>;
|
|
31
31
|
stats(): Promise<any>;
|
|
32
32
|
count(condition?: any): Promise<number>;
|
|
@@ -95,20 +95,17 @@ export class MClient {
|
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
distinct(key, condition = {}) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
reject(e);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const connection = yield this.getConnected();
|
|
100
|
+
try {
|
|
101
|
+
return yield connection.collection.distinct(key, condition);
|
|
102
|
+
}
|
|
103
|
+
catch (e) {
|
|
104
|
+
throw e;
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
connection.client.close();
|
|
108
|
+
}
|
|
112
109
|
});
|
|
113
110
|
}
|
|
114
111
|
remove(condition) {
|