I want to initialize variable in the beginning by date than change the variable with the date comes from the request for example :
filterByDate(startDate,endDate){
startDate = new Date('2022-01-01');
endDate = new Date();
return this.dataModel.aggregate([
{
$match: { $gte:startDate,$lte:endDate }
}
])
}
I got only data with matched date initialized in startDate endDate
If I console the passed data in the request it shows what I put in startDate endDate
any help please