@tomsd/mongodbclient 2.7.5 → 2.7.8
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.
|
@@ -25,8 +25,8 @@ export declare class MClient {
|
|
|
25
25
|
connect(): Promise<any>;
|
|
26
26
|
protected getConnected(): Promise<any>;
|
|
27
27
|
upsert(pobj: any): Promise<any>;
|
|
28
|
-
read(condition?: any, opt?: any): Promise<
|
|
29
|
-
distinct(key: string, condition?: any): Promise<
|
|
28
|
+
read(condition?: any, opt?: any): Promise<any>;
|
|
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>;
|
|
@@ -82,38 +82,34 @@ class MClient {
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
read(condition = {}, opt) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
.
|
|
91
|
-
.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
const connection = yield this.getConnected();
|
|
87
|
+
try {
|
|
88
|
+
return yield connection
|
|
89
|
+
.collection
|
|
90
|
+
.find(condition, opt)
|
|
91
|
+
.toArray();
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
throw e;
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
connection.client.close();
|
|
98
|
+
}
|
|
100
99
|
});
|
|
101
100
|
}
|
|
102
101
|
distinct(key, condition = {}) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
reject(e);
|
|
115
|
-
});
|
|
116
|
-
});
|
|
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
|
+
}
|
|
117
113
|
});
|
|
118
114
|
}
|
|
119
115
|
remove(condition) {
|
|
@@ -25,8 +25,8 @@ export declare class MClient {
|
|
|
25
25
|
connect(): Promise<any>;
|
|
26
26
|
protected getConnected(): Promise<any>;
|
|
27
27
|
upsert(pobj: any): Promise<any>;
|
|
28
|
-
read(condition?: any, opt?: any): Promise<
|
|
29
|
-
distinct(key: string, condition?: any): Promise<
|
|
28
|
+
read(condition?: any, opt?: any): Promise<any>;
|
|
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>;
|
|
@@ -78,38 +78,34 @@ export class MClient {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
read(condition = {}, opt) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
.
|
|
87
|
-
.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
});
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const connection = yield this.getConnected();
|
|
83
|
+
try {
|
|
84
|
+
return yield connection
|
|
85
|
+
.collection
|
|
86
|
+
.find(condition, opt)
|
|
87
|
+
.toArray();
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
throw e;
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
connection.client.close();
|
|
94
|
+
}
|
|
96
95
|
});
|
|
97
96
|
}
|
|
98
97
|
distinct(key, condition = {}) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
reject(e);
|
|
111
|
-
});
|
|
112
|
-
});
|
|
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
|
+
}
|
|
113
109
|
});
|
|
114
110
|
}
|
|
115
111
|
remove(condition) {
|