OPTIONS
翻译或纠错本页面

Arithmetic Aggregation Operators

Arithmetic expressions perform mathematic operations on numbers. Some arithmetic expressions can also support date arithmetic.

Name Description
$add Adds numbers to return the sum, or adds numbers and a date to return a new date. If adding numbers and a date, treats the numbers as milliseconds. Accepts any number of argument expressions, but at most, one expression can resolve to a date.
$subtract Returns the result of subtracting the second value from the first. If the two values are numbers, return the difference. If the two values are dates, return the difference in milliseconds. If the two values are a date and a number in milliseconds, return the resulting date. Accepts two argument expressions. If the two values are a date and a number, specify the date argument first as it is not meaningful to subtract a date from a number.
$multiply Multiplies numbers to return the product. Accepts any number of argument expressions.
$divide Returns the result of dividing the first number by the second. Accepts two argument expressions.
$mod Returns the remainder of the first number divided by the second. Accepts two argument expressions.