fix dates

This commit is contained in:
Emily
2024-12-03 17:40:37 +01:00
parent 30e428a8dc
commit b630bddef0
4 changed files with 9 additions and 8 deletions

View File

@@ -18,7 +18,12 @@ export default defineEventHandler(async event => {
return await Redis.useCacheV2(cacheKey, cacheExp, async () => {
const result = await VisitModel.aggregate([
{ $match: { project_id }, },
{
$match: {
project_id,
created_at: { $gte: new Date(from), $lte: new Date(to) }
},
},
{ $match: { website: websiteName, }, },
{ $group: { _id: "$page", count: { $sum: 1, } } },
{ $sort: { count: -1 } },