Hierarchy

  • DateTrunc

Properties

Properties

$dateTrunc: {
    binSize?: NumberExpression;
    date: DateExpression;
    startOfWeek?: StringExpression<StartOfWeek>;
    timezone?: tzExpression;
    unit: StringExpression<DateUnit>;
}

Truncates a date.

Type declaration

  • Optional binSize?: NumberExpression

    The numeric time value, specified as an expression that must resolve to a positive non-zero number. Defaults to 1.

    Together, binSize and unit specify the time period used in the $dateTrunc calculation.

  • date: DateExpression

    The date to truncate, specified in UTC. The date can be any expression that resolves to a Date, a Timestamp, or an ObjectID.

  • Optional startOfWeek?: StringExpression<StartOfWeek>

    Used when the unit is equal to week. Defaults to Sunday. The startOfWeek parameter is an expression that resolves to a case insensitive string:

    • monday (or mon)
    • tuesday (or tue)
    • wednesday (or wed)
    • thursday (or thu)
    • friday (or fri)
    • saturday (or sat)
    • sunday (or sun)
  • Optional timezone?: tzExpression

    The timezone of the operation result. must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC.

  • unit: StringExpression<DateUnit>

    The unit of time, specified as an expression that must resolve to one of these strings:

    • year
    • quarter
    • week
    • month
    • day
    • hour
    • minute
    • second
    • millisecond

    Together, binSize and unit specify the time period used in the $dateTrunc calculation.

Generated using TypeDoc