Skip to main content

$abs

The $abs operator returns the absolute value of a number.

Input

  • A single numeric value

Output

  • The absolute value of the input

Examples

Positive Number

{
  "$abs": [
    5
  ]
}
Result: 5

Negative Number

{
  "$abs": [
    -3.5
  ]
}
Result: 3.5

Field Value

{
  "$abs": [
    {
      "$input": "temperature_change"
    }
  ]
}
Result: The absolute value of the temperature_change field