Просмотр исходного кода

Merge pull request #9334 from weseek/support/omit-mongodb-4.4-compatible-code

support: Omit MongoDB 4.x compatible code
mergify[bot] 1 год назад
Родитель
Сommit
26f4529287

+ 1 - 1
apps/app/docker/README.md

@@ -27,7 +27,7 @@ see: [weseek/growi](https://github.com/weseek/growi)
 Requirements
 -------------
 
-* MongoDB (>= 4.4)
+* MongoDB (>= 6.0)
 
 ### Optional Dependencies
 

+ 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' },