Hi,
We have a requirement where we need to convert dates stored in mongodb to the user specified timezone while doing a find query or
retrieving it.
This is applicable to all the dates. We are using nodejs / mongoose.
I tried to use aggregation projection datetostring but it doesnt seem to take effect.
Can anyone share how to achieve it.
I tried below , which has no effect .Program is my Model.
Program.findById(req.params.programId,"-ae_config"/*, {"$expr": [{
"$project": {
date: { $dateToString: { "format": "%Y-%m-%d", date: "programStartDate", timezone: "America/New_York"} },
}
}]}*/).populate('roles').exec(function (err, program) {