chen 4 år sedan
förälder
incheckning
ff97c88707
1 ändrade filer med 11 tillägg och 1 borttagningar
  1. 11 1
      app/service/intelligentDocking.js

+ 11 - 1
app/service/intelligentDocking.js

@@ -169,7 +169,7 @@ class IntelligentDockingService extends CrudService {
 
     const total = await this.model.countDocuments(query);
     const result = await this.model.aggregate([
-      { $match: query },
+      //      { $match: query },
       { $project:
           {
             ensure_id: 1,
@@ -264,8 +264,18 @@ class IntelligentDockingService extends CrudService {
             finance_claims: '$finance_claims',
             dictionary: '$dictionary',
             follow: '$follow',
+            uuid: { $toObjectId: '$follow.uuid' },
+          },
+      },
+      { $lookup:
+          {
+            from: 'other_user',
+            localField: 'uuid',
+            foreignField: '_id',
+            as: 'otherUser',
           },
       },
+      { $unwind: { path: '$otherUser', preserveNullAndEmptyArrays: true } },
       { $skip: (skip - 1) * limit },
       { $limit: limit },
       { $sort: { time: -1 } },