$hour / $minute / $second / $millisecond
Reference group: Date expressions
What it does
Extracts time components; without timezone, date-part operators use UTC.
Syntax
Date-part expressions
Use case
Analyze activity by hour.
$hour / $minute / $second / $millisecond: practical example
{ $project: { hourUtc: { $hour: "$createdAt" } } }💡 Explanation
Extracts time components; without timezone, date-part operators use UTC.
When to use it
Analyze activity by hour.
Key Takeaways
- Extracts time components; without timezone, date-part operators use UTC.
- Typical use: Analyze activity by hour.