cgserver 6.0.8 → 6.1.1
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,8 +35,8 @@ 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
|
|
39
|
-
let rs = await MongoManager_1.GMongoMgr.
|
|
38
|
+
async countDocuments(where, options) {
|
|
39
|
+
let rs = await MongoManager_1.GMongoMgr.countDocuments(this._table, where);
|
|
40
40
|
return rs.count;
|
|
41
41
|
}
|
|
42
42
|
async gets(property, where, sort, skip = 0, limit = 0) {
|
|
@@ -176,7 +176,7 @@ class MongoManager {
|
|
|
176
176
|
rs.list = list;
|
|
177
177
|
return rs;
|
|
178
178
|
}
|
|
179
|
-
async
|
|
179
|
+
async countDocuments(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
|
-
|
|
21
|
+
countDocuments(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
|
-
|
|
65
|
+
countDocuments(collection: string, where?: {}, options?: mongo.CountDocumentsOptions): Promise<{
|
|
66
66
|
errcode: {
|
|
67
67
|
id: number;
|
|
68
68
|
des: string;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cgserver",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"author": "trojan",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "free for all.Websocket or Http",
|
|
7
|
-
"main": "./dist/cgserver.js",
|
|
7
|
+
"main": "./dist/lib/cgserver.js",
|
|
8
8
|
"types": "./dist/types/cgserver.d.ts",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|