Edit

Share via


ARRAY_MIN (NoSQL query)

APPLIES TO: NoSQL

Returns the minimal value of elements in the specified array expression.

Syntax

ARRAY_MIN(<array_expr>)  

Arguments

Description
array_expr An array expression.

Return types

Returns a numeric/boolean/string expression.

Examples

The following example shows the results of using this function on arrays with different data types.

SELECT VALUE {
    "case1": ARRAY_MIN([1, 2, 3, 4]),
    "case2": ARRAY_MIN(['abc', 'ABC', 'aBc', 'AbC']),
    "case3": ARRAY_MIN([true, false]),
    "case4": ARRAY_MIN([null, null]),
    "case5": ARRAY_MIN([12, 'abc', true, false, null, undefined])
}
[
    {
        "case1": 1,
        "case2": "ABC",
        "case3": false,
        "case4": null,
        "case5": null
    }
]

Remarks

  • The elements in array can be number, string, boolean, or null.
  • Any undefined values are ignored.
  • The following priority order is used (in descending order), when comparing different types of data:
    • string
    • number
    • boolean
    • null
  • This function performs a full scan.