Date operators are used to extract date information from date fields, when we want to calculate statistics based on day of week/month/year using the pipeline.
- $dayOfYear is used to get the day of year with a range of 1 to 366 for a leap year
- $dayOfMonth is used to get the day of month with a range of 1 to 31 inclusive
- $dayOfWeek is used with 1 being Sunday and 7 being Saturday (US style days)
- $isoDayOfWeek returns the weekday number in the ISODate 8601 format, with 1 being Monday and 7 being Sunday
- $week is the week number with 0 being the partial week at the beginning of each year to 53 for a year with a leap week
- $isoWeek returns week number in the ISODate 8601 format, 1 being the first week of the year that contains a Thursday and 53, a leap week if one exists
- $year / $month / $hour / $minute / $milliSecond return the relevant portion of the date in zero based numbering, except for $month which returns 1 through 12 inclusive.
- $isoWeekYear returns the year in the ISO 8601 format according to the date the last week in ISODate ends (that is, 2016/1/1 will still return 2015)
- $second returns 0 to 60 inclusive for leap seconds
- $dateToString converts a date input to a string