$mod

$mod operator helps you in finding the modules value in an given array expression. You can use this in any Expression Object.

Syntax

{
    "$mod":[ <divider> , <dividend> ]
}

Properties

FieldDescriptionRequired

<divider | dividend>

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

It can also be a Magical Autocomplete.

true

Returns

number - The result of $max operation

Examples

Basic example

{
    "$mod": [5,2]
}

The above expression returns 1

With Nested Expressions

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

The above expression calculates the nested expression, return 3,4 respectively in its place and then the outer $mod expression returns 3 overall.

With Magical Autocomplete

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

{
    "$max":"$.variables.temp"
}

The above expression would resolve to a result of 1

Last updated