fix(forums): today new topics and new replies count

This commit is contained in:
OldHawk
2017-08-11 15:55:52 +08:00
parent 22f60fa880
commit 71989d3285
3 changed files with 19 additions and 4 deletions

View File

@@ -51,12 +51,20 @@ exports.list = function (req, res) {
Topic.aggregate({
$project: {
'forum': '$forum',
'year': {
'$year': '$createdAt'
},
'month': {
'$month': '$createdAt'
},
'day': {
'$dayOfMonth': '$createdAt'
}
}
}, {
$match: {
year: moment.utc().year(),
month: moment.utc().month() + 1,
day: moment.utc().date()
}
}, {
@@ -79,14 +87,20 @@ exports.list = function (req, res) {
}, {
$project: {
'forum': '$forum',
//'title': '$title',
//'createdAt': '$_replies.createdAt',
'year': {
'$year': '$_replies.createdAt'
},
'month': {
'$month': '$_replies.createdAt'
},
'day': {
'$dayOfMonth': '$_replies.createdAt'
}
}
}, {
$match: {
year: moment.utc().year(),
month: moment.utc().month() + 1,
day: moment.utc().date()
}
}, {