Skip to main content

$pow

The $pow operator raises the first value to the power of the second value.

Input

  • An array containing exactly two numeric values: the base and the exponent

Output

  • The first value raised to the power of the second value

Examples

Basic Power

{
  "$pow": [
    2,
    3
  ]
}
Result: 8

Square Root (power of 0.5)

{
  "$pow": [
    16,
    0.5
  ]
}
Result: 4

Negative Base

{
  "$pow": [
    -2,
    3
  ]
}
Result: -8

Field Value

{
  "$pow": [
    {
      "$input": "base_value"
    },
    {
      "$input": "exponent"
    }
  ]
}
Result: The base_value field raised to the power of the exponent field