Fix popular courses match stage
This commit is contained in:
@@ -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"}, [] ] } } }
|
||||||
|
|||||||
@@ -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";
|
||||||
|
|||||||
Reference in New Issue
Block a user