I need to parse date value to specific format without using format field in dateFromString operator.
Mongo Playground
Current situation : in Mongodb 4.0 if I f
This worked for me: I used combined solution from @ambienBeing and @techstack. Thanks
Mongo playground
"parsedDate": {
"$dateFromParts": {
"year": {
"$year": {
$dateFromString: {
dateString: {
"$concat": [
"$_id.dateHour",
":00:00Z"
]
}
}
}
},
"month": {
"$month": {
$dateFromString: {
dateString: {
"$concat": [
"$_id.dateHour",
":00:00Z"
]
}
}
}
},
"day": {
"$dayOfMonth": {
$dateFromString: {
dateString: {
"$concat": [
"$_id.dateHour",
":00:00Z"
]
}
}
}
},
"hour": {
"$hour": {
$dateFromString: {
dateString: {
"$concat": [
"$_id.dateHour",
":00:00Z"
]
}
}
}
}
}
},