yusuketk пре 6 година
родитељ
комит
170d742ef3
1 измењених фајлова са 1 додато и 3 уклоњено
  1. 1 3
      src/server/models/page-tag-relation.js

+ 1 - 3
src/server/models/page-tag-relation.js

@@ -44,9 +44,7 @@ class PageTagRelation {
     const offset = opt.offset || 0;
     const limit = opt.limit || 50;
 
-    const existTags = await Tag.find();
-    const existTagIds = existTags.map((tag) => { return tag._id });
-
+    const existTagIds = await Tag.find().distinct('_id');
     const tags = await this.aggregate()
       .match({ relatedTag: { $in: existTagIds } })
       .group({ _id: '$relatedTag', count: { $sum: 1 } })