$pow

$pow operator lets you calculate power of return the result of the expression. You can use this in any Expression Object.

Syntax

{
    "$pow": [ <number>, <exponent> ]
}

Properties

FieldDescriptionRequired

<number>

The <number> expression can be any valid expression as long as it resolves to a number.

true

<exponent>

The <exponent> expression can be any valid expression as long as it resolves to a number.

true

Returns

float - The result of $pow operation

Examples

Basic example

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

The above expression returns 4.0 (2^2)

With Nested Expressions

{
    "$pow": [
        {
            "$add": [1, 2]
        },
        2
    ]
}

The above expression calculates the nested expression, return 3 in its place and then the outer $pow expression returns 9 overall.

With Magical Autocomplete

Let's say we have declared a variable temp in our API flow, which has a value of 5 currently.

{
    "$pow": ["$.variables.temp", 3]
}

The above expression would resolve to a result of 125.0 (5^3 = 5*5*5)

Last updated