Reputation: 5
I have a collection called members
and here is a sample data:
{
"_id": 123,
"name": "Jackie",
"dob": "31/12/18"
}
Is it possible to convert the dd/mm/yy format to dd/mm/yyyy? As $dateFromString only accepts the latter.
(p.s. $toString/$toInt/$toDecimal is not supported as the MongoDB version is before version 4)
Upvotes: 0
Views: 41
Reputation: 14530
Use https://docs.mongodb.com/manual/reference/operator/aggregation/split/ then https://docs.mongodb.com/manual/reference/operator/aggregation/concat/ to get the format you want.
Upvotes: 1