fix date sort

This commit is contained in:
Emily
2024-12-02 15:53:15 +01:00
parent b700b96191
commit 30e428a8dc
2 changed files with 8 additions and 3 deletions

View File

@@ -52,7 +52,7 @@ export async function executeAdvancedTimelineAggregation<T = {}>(options: Advanc
...options.customGroup
}
},
{ $sort: sort },
{ $sort: { firstDate: 1 } },
{
$project: {
_id: "$firstDate",
@@ -60,9 +60,12 @@ export async function executeAdvancedTimelineAggregation<T = {}>(options: Advanc
...options.customProjection
}
}
]
] as any;
if (options.debug === true) {
console.log('---------- SORT ----------')
console.log(JSON.stringify(sort, null, 2));
console.log('---------- AGGREAGATION ----------')
console.log(JSON.stringify(aggregation, null, 2));
}