Преглед изворни кода

omit MongoDB 4.4 compatible code

Yuki Takei пре 1 година
родитељ
комит
3a302f458c
1 измењених фајлова са 2 додато и 23 уклоњено
  1. 2 23
      apps/app/src/server/service/search-delegator/aggregate-to-index.ts

+ 2 - 23
apps/app/src/server/service/search-delegator/aggregate-to-index.ts

@@ -51,32 +51,11 @@ export const aggregatePipelineToIndex = (maxBodyLengthToIndex: number, query?: Q
 
     // join Comment
     {
-      // MongoDB 5.0 or later can use concise syntax
-      // https://www.mongodb.com/docs/v6.0/reference/operator/aggregation/lookup/#correlated-subqueries-using-concise-syntax
-      // $lookup: {
-      //   from: 'comments',
-      //   localField: '_id',
-      //   foreignField: 'page',
-      //   pipeline: [
-      //     {
-      //       $addFields: {
-      //         commentLength: { $strLenCP: '$comment' },
-      //       },
-      //     },
-      //   ],
-      //   as: 'comments',
-      // },
       $lookup: {
         from: 'comments',
-        let: { pageId: '$_id' },
+        localField: '_id',
+        foreignField: 'page',
         pipeline: [
-          {
-            $match: {
-              $expr: {
-                $eq: ['$page', '$$pageId'],
-              },
-            },
-          },
           {
             $addFields: {
               commentLength: { $strLenCP: '$comment' },