Articles → MONGODB → $Isoweekyear Operator In Mongodb
$Isoweekyear Operator In Mongodb
Purpose
What Is A Week-Year?
Date | Weekday |
---|
29-Dec-2014 | Monday |
30-Dec-2014 | Tuesday |
31-Dec-2014 | Wednesday |
01-Jan-2015 | Thursday |
02-Jan-2015 | Friday |
03-Jan-2015 | Saturday |
04-Jan-2015 | Sunday |
Example
db.sales.aggregate([
{
$addFields: {
isoWeekYear: { $isoWeekYear: "$date" }
}
}
])
Output