In MongoDB, the $dayOfYear
aggregation pipeline operator returns the day of the year for a date as a number between 1
and 366
.
You can optionally specify a timezone to use for the result.
The $dayOfYear
operator accepts either a date (as either a Date, a Timestamp, or an ObjectId), or a document that specifies the date and timezone to use.