ruifeng_liu 3 лет назад
Родитель
Сommit
ff7f1bb625
1 измененных файлов с 4 добавлено и 5 удалено
  1. 4 5
      app/service/patent/patentnotice.js

+ 4 - 5
app/service/patent/patentnotice.js

@@ -16,16 +16,15 @@ class PatentnoticeService extends CrudService {
   }
 
   async query(query, { skip = 0, limit = 0 } = {}) {
-    query = await this.resetQuery(query);
-    console.log(query);
-    const data = await this.model.find(query).skip(parseInt(skip)).limit(parseInt(limit))
+    const nq = await this.resetQuery(_.cloneDeep(query));
+    const data = await this.model.find(nq).skip(parseInt(skip)).limit(parseInt(limit))
       .sort({ 'meta.createdAt': -1 });
     return data;
   }
 
   async count(query) {
-    query = await this.resetQuery(query);
-    const res = await this.model.countDocuments(trimData(query)).exec();
+    const nq = await this.resetQuery(_.cloneDeep(query));
+    const res = await this.model.count(nq);
     return res;
   }