Inden for MongoDB 3.6 kan du nu bruge $dateFromString
(https://docs.mongodb.com/manual/reference/operator /aggregation/dateFromString/
)
db.logmessages.aggregate( [ {
$project: {
date: {
$dateFromString: {
dateString: '$date'
}
}
}
}, { $sort: { date : 1} } ] )