hello, I am doing an aggregate query using $function to calculate a date and save it in another format
Order.aggregate([
{
$addfields: {
newField: {
$function: {
body: function(vistaDate){return moment(vistaDate).formato("YYYY-MM-DD")},
arg: ["$vistaDate"],
lang: "js"
}
}
}
}
])
Error
MongoError: PlanExecutor error during aggregation :: caused by :: ReferenceError: _momentTimezone is not defined : body@:2:24
Thanks
L.