- Reference >
- Operators >
- Aggregation Pipeline Operators >
- Date Aggregation Operators >
- $millisecond (aggregation)
$millisecond (aggregation)¶
On this page
Definition¶
-
$millisecond
¶ Returns the millisecond portion of a date as an integer between 0 and 999.
The
$millisecond
expression has the following syntax:The argument can be any expression as long as it resolves to a date. For more information on expressions, see Expressions.
Example¶
Consider a sales
collection with the following document:
The following aggregation uses the $millisecond
and other
date operators to break down the date
field:
The operation returns the following result: