From 58fda40c2041d5c224fd142b758116ef43a87e4f Mon Sep 17 00:00:00 2001 From: aeroreyna Date: Wed, 16 Feb 2022 22:40:21 -0800 Subject: [PATCH] Fix popular courses match stage --- dbTools/profile.js | 2 +- routes/post.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dbTools/profile.js b/dbTools/profile.js index 8513e12..0985e76 100644 --- a/dbTools/profile.js +++ b/dbTools/profile.js @@ -71,7 +71,7 @@ userDB = (DB) => { DB.getPopularGroups = async (limit = 10) => { return DB.profileCols.aggregate([ { - $match: {isGroup: true, isPrivate: false, isCourse: false} + $match: {isGroup: true, isPrivate: {$ne: true}, isCourse: {$ne: true}} }, { $addFields: { subscribed_count: {$size: { "$ifNull": [ {"$objectToArray" : "$subscribed"}, [] ] } } } diff --git a/routes/post.js b/routes/post.js index 4d1b123..c6ab917 100644 --- a/routes/post.js +++ b/routes/post.js @@ -26,7 +26,7 @@ DB.getDB.then((DB) => { content += "@p:" + p._id + "\n"; }); let popularProfilesPost = new Post({profileid: 1, content, nonOrganicType: "PopularUsers"}); - const popularGroups = await DB.getPopularGroups(5); + const popularGroups = await DB.getPopularGroups(15); content = "Popular users to follow:\n"; popularGroups.forEach((p)=>{ content += "@p:" + p._id + "\n";