date format in mongodb code example
Example: mongodb check date only without time
db.collection.aggregate([{
$addFields: {
onlyDate: {
$dateToString: {
format: '%Y-%m-%d',
date: '$date'
}
}
}
},
{
$match: {
onlyDate: {
'$eq': onlyTodayDate
}
}
}
]);