cgserver 6.0.9 → 6.1.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.
|
@@ -35,7 +35,7 @@ class BaseService {
|
|
|
35
35
|
let rs = await MongoManager_1.GMongoMgr.findOne(this._table, proterty, where, sort);
|
|
36
36
|
return rs.one;
|
|
37
37
|
}
|
|
38
|
-
async getTotal(where) {
|
|
38
|
+
async getTotal(where, options) {
|
|
39
39
|
let rs = await MongoManager_1.GMongoMgr.findCount(this._table, where);
|
|
40
40
|
return rs.count;
|
|
41
41
|
}
|
|
@@ -176,7 +176,7 @@ class MongoManager {
|
|
|
176
176
|
rs.list = list;
|
|
177
177
|
return rs;
|
|
178
178
|
}
|
|
179
|
-
async findCount(collection,
|
|
179
|
+
async findCount(collection, where, options) {
|
|
180
180
|
this._convertWhere(where);
|
|
181
181
|
let rs = { errcode: null, count: -1 };
|
|
182
182
|
if (!this._mongo) {
|
|
@@ -186,7 +186,7 @@ class MongoManager {
|
|
|
186
186
|
let count = -1;
|
|
187
187
|
try {
|
|
188
188
|
let col = this._mongo.collection(collection);
|
|
189
|
-
count = await col.countDocuments(where || {},
|
|
189
|
+
count = await col.countDocuments(where || {}, options);
|
|
190
190
|
}
|
|
191
191
|
catch (e) {
|
|
192
192
|
Log_1.GLog.error(e);
|
|
@@ -18,7 +18,7 @@ export declare class BaseService<T> {
|
|
|
18
18
|
*/
|
|
19
19
|
getById(id: any): Promise<any>;
|
|
20
20
|
get(proterty?: {}, where?: {}, sort?: {}): Promise<any>;
|
|
21
|
-
getTotal(where?: {}): Promise<number>;
|
|
21
|
+
getTotal(where?: {}, options?: mongo.CountDocumentsOptions): Promise<number>;
|
|
22
22
|
gets(property?: {}, where?: {}, sort?: {}, skip?: number, limit?: number): Promise<any[]>;
|
|
23
23
|
getRandoms(num: number, proterty?: {}, where?: {}): Promise<any[]>;
|
|
24
24
|
updateOne(model: any, where?: {}, upsert?: boolean): Promise<{
|
|
@@ -62,7 +62,7 @@ declare class MongoManager {
|
|
|
62
62
|
};
|
|
63
63
|
list: any[];
|
|
64
64
|
}>;
|
|
65
|
-
findCount(collection: string,
|
|
65
|
+
findCount(collection: string, where?: {}, options?: mongo.CountDocumentsOptions): Promise<{
|
|
66
66
|
errcode: {
|
|
67
67
|
id: number;
|
|
68
68
|
des: string;
|