<< Click to Display Table of Contents >> Math |
Functions |
Syntax |
Instructions |
Examples |
---|---|---|---|
abs |
{ $abs: <number> } |
Returns the absolute value of a number. |
For example: { $abs: -3 } |
acos |
{ $acos: <expression> } |
Returns the inverse cosine (arc cosine) of a value. |
For example: { $acos : "$col" }; |
acosh |
{ $acosh: <expression> } |
Returns the inverse hyperbolic cosine (hyperbolic arc cosine) of a value. |
For example: { $acosh: "$col" } |
add |
{ $add: [ <expression1>, <expression2>, ... ] } |
Adds numbers together or adds numbers and a date. If one of the arguments is a date, $add treats the other arguments as milliseconds to add to the date. |
For example: { $add: [ 1, 2 ] } |
asin |
{ $asin: <expression> } |
Returns the inverse sine (arc sine) of a value. |
For example: { $asin: "$col" } |
asinh |
{ $asinh: <expression> } |
Returns the inverse hyperbolic sine (hyperbolic arc sine) of a value. |
For example: { $asinh: "$col" }; |
atan |
{ $atan: <expression> } |
Returns the inverse tangent (arc tangent) of a value. |
For example: { $atan: "$col" } |
atan2 |
{ $atan2: [ <expression 1>, <expression 2> ] } |
Returns the inverse tangent (arc tangent) of y / x, where y and x are the first and second values passed to the expression respectively. |
For example: { $atan2 : [ "$side_b", "$side_a" ] } |
ceil |
{ $ceil: <number> } |
Returns the smallest integer greater than or equal to the specified number. |
For example: { $ceil: 7.80" } |
cos |
{ $cos: <expression> } |
Returns the cosine of a value that is measured in radians. |
For example: { $cos: "$value" } |
divide |
{ $divide: [ <expression1>, <expression2> ] } |
Divides one number by another and returns the result. |
For example: { $divide: [ 8, 8 ] } |
exp |
{ $exp: <exponent> } |
Raises Euler’s number (i.e. e ) to the specified exponent and returns the result. |
For example: { $exp: 0 } |
floor |
{ $floor: <number> } |
Returns the largest integer less than or equal to the specified number. |
For example: { $floor: 9.25 } |
ln |
{ $ln: <number> } |
Calculates the natural logarithm ln (i.e loge) of a number and returns the result as a double. |
For example: { $ln: 10 } |
log |
{ $log: [ <number>, <base> ] } |
Calculates the log of a number in the specified base and returns the result as a double. |
For example: { $log: [ 100, 10 ] } |
log10 |
{ $log10: <number> } |
Calculates the log base 10 of a number and returns the result as a double. |
For example: { $log10: 100 } |
mod |
{ $mod: [ <expression1>, <expression2> ] } |
Divides one number by another and returns the remainder. |
For example: { $mod: [ 15, 4 ] } |
multiply |
{ $multiply: [ <expression1>, <expression2>, ... ] } |
Multiplies numbers together and returns the result. |
For example: { $multiply: [ 10, 0.1 ] } |
pow |
{ $pow: [ <number>, <exponent> ] } |
Raises a number to the specified exponent and returns the result. |
For example: { $pow: [ 5, 2 ] } |
range |
{ $range: [ <start>, <end>, <non-zero step> ] } |
Returns an array whose elements are a generated sequence of numbers. $range generates the sequence from the specified starting number by successively incrementing the starting number by the specified step value up to but not including the end point. |
For example: { $range: [ 0, 10, 2 ] } |
round |
{ $round : [ <number>, <place> ] } |
$round rounds a number to to a whole integer or to a specified decimal place. |
For example: { $round: [ 2.22, 1 ] } |
sin |
{ $sin: <expression> } |
Returns the sine of a value that is measured in radians. |
For example: { $sin: "$col" }; |
sqrt |
{ $sqrt: <number> } |
Calculates the square root of a positive number and returns the result as a double. |
For example: { $sqrt: 25 } |
subtract |
{ $subtract: [ <expression1>, <expression2> ] } |
Subtracts two numbers to return the difference, or two dates to return the difference in milliseconds, or a date and a number in milliseconds to return the resulting date. |
For example: { $subtract: [ 3, 2 ] } |
tan |
{ $tan: <expression> } |
Returns the tangent of a value that is measured in radians. |
For example: { $tan: "$col" } |
trunc |
{ $trunc : [ <number>, <place> ] } |
$trunc truncates a number to a whole integer or to a specified decimal place. |
For example: { $trunc: [ 1.56, 1 ] } |