Arithmetic Operators

Operator

Description

Example

$trunc

Truncates a number down to an integer.

{"$trunc": "c_value"}

$sqrt

Takes the square root of an aggregated number.

{"$sqrt": {"$add": "c_value"}}

$ln

Takes the log of a number.

{"$ln": "c_number"}

$floor

Returns the largest integer less than or equal to the number

{"$floor": "c_number"}

$exp

Takes the e^n of a number

{"$exp": "c_number"}

$ceil

Returns the smallest integer greater than or equal to the specified number.

{"$ceil": "c_number"}

$abs

Takes the absolute value of a number.

{"$abs": "c_number"}

$add

Adds two or more array properties or expressions. In addition to numbers, a single Date value may be included in the array.

{"$add": ["created", "c_msOffset"]}

$multiply

Multiplies two or more number properties or expressions in the passed in array.

{"$multiply": ["c_bpm", "c_scalar", {"$number": 0.99}]}

$subtract

Subtracts the second element from the first in the passed in array. In addition to number properties, numbers and dates maybe be subtracted from a date value.

{"$subtract": ["created", "updated"]}

$divide

Divides the second element by the first in the passed in array.

{"$divide": ["c_bpm", {"$number": 0.9}]}

$mod

Divides the second element by the first in the passed in array, and returns the remainder.

{"$divide": ["c_bpm", {"$number": 20}]}

$pow

Raises the first number to the power of the second number.

{"$pow": ["c_heartrate", {"$number": 2}]}

$log

Takes the log of the first number in the second number's base.

{"$log": [100, 10]}