$min

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

Syntax

{
    "$min":[ <expr>, <expr> ... ]
}

Properties

Returns

float - The result of $min operation

Examples

Basic example

{
    "$min": [1,5,3,6,2]
}

The above expression returns 1

With Nested Expressions

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

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

With Magical Autocomplete

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

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

The above expression would resolve to a result of 1

Last updated