In MongoDB, the $hour
aggregation pipeline operator returns the hour portion of a date as a number between 0
and 23
.
You can optionally specify a timezone to use for the result.
The $hour
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.