cgserver 8.9.1 → 8.9.2

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.
@@ -393,7 +393,7 @@ class MongoManager {
393
393
  rs.rs = i_rs;
394
394
  return rs;
395
395
  }
396
- async simpleAggregate(collection, property = {}, where = {}, size, random_size) {
396
+ async simpleAggregate(collection, property, where, size, random_size) {
397
397
  this._convertWhere(where);
398
398
  let rs = { errcode: null, list: null };
399
399
  if (!this._mongoDb) {
@@ -404,8 +404,12 @@ class MongoManager {
404
404
  try {
405
405
  let col = this._mongoDb.collection(collection);
406
406
  let params = [];
407
- params.push({ '$match': where || {} });
408
- params.push({ '$project': property || {} });
407
+ if (where) {
408
+ params.push({ '$match': where });
409
+ }
410
+ if (property) {
411
+ params.push({ '$project': property });
412
+ }
409
413
  if (random_size) {
410
414
  params.push({ '$sample': { 'size': random_size } });
411
415
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "8.9.1",
3
+ "version": "8.9.2",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",