我的数据库(数据)中的所有文档都有一个tags_data:
tags_data : [ "am", "gi", "bab", "as", "bru", "dan", "tea", "wec", "fuy" ]
所以我想对所有标签的概述与每个标签的出现次数进行排序,如果可能的话,按降序排序
我想尝试这样做:db.data.aggregate(
{$unwind: '$tags_data'},
{$group: {_id: '$tags_data', sum: {$sum: +1}}}
);
谢谢和问候
答案 0 :(得分:0)
答案是:
SELECT smf_user_points_log.id_member, smf_members.usertitle
FROM smf_user_points_log
INNER JOIN smf_members
ON smf_members.id_member=smf_user_points_log.id_member
WHERE smf_user_points_log.id_school_year = (SELECT id_school_year FROM smf_settings) AND smf_user_points_log.points >= 50 AND smf_members.date_registered < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 30 DAY))
感谢