Binnen MongoDB 3.6 kunt u nu $dateFromString
. gebruiken (https://docs.mongodb.com/manual/reference/operator /aggregation/dateFromString/
)
db.logmessages.aggregate( [ {
$project: {
date: {
$dateFromString: {
dateString: '$date'
}
}
}
}, { $sort: { date : 1} } ] )