Fix popular courses match stage

This commit is contained in:
aeroreyna
2022-02-16 22:40:21 -08:00
parent e0c6470bce
commit 58fda40c20
2 changed files with 2 additions and 2 deletions

View File

@@ -71,7 +71,7 @@ userDB = (DB) => {
DB.getPopularGroups = async (limit = 10) => { DB.getPopularGroups = async (limit = 10) => {
return DB.profileCols.aggregate([ 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"}, [] ] } } } $addFields: { subscribed_count: {$size: { "$ifNull": [ {"$objectToArray" : "$subscribed"}, [] ] } } }

View File

@@ -26,7 +26,7 @@ DB.getDB.then((DB) => {
content += "@p:" + p._id + "\n"; content += "@p:" + p._id + "\n";
}); });
let popularProfilesPost = new Post({profileid: 1, content, nonOrganicType: "PopularUsers"}); 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"; content = "Popular users to follow:\n";
popularGroups.forEach((p)=>{ popularGroups.forEach((p)=>{
content += "@p:" + p._id + "\n"; content += "@p:" + p._id + "\n";