IS_ARRAY (Azure Cosmos DB)IS_ARRAY (Azure Cosmos DB)

返回一个布尔值,指示指定表达式类型是否为数组。Returns a Boolean value indicating if the type of the specified expression is an array.

语法Syntax

IS_ARRAY(<expr>)  

参数Arguments

exprexpr
是任何表达式。Is any expression.

返回类型Return types

返回一个布尔表达式。Returns a Boolean expression.

示例Examples

以下示例使用 IS_ARRAY 函数检查 JSON 布尔、数字、字符串、null、对象、数组和 undefined 类型的对象。The following example checks objects of JSON Boolean, number, string, null, object, array, and undefined types using the IS_ARRAY function.

SELECT   
 IS_ARRAY(true) AS isArray1,   
 IS_ARRAY(1) AS isArray2,  
 IS_ARRAY("value") AS isArray3,  
 IS_ARRAY(null) AS isArray4,  
 IS_ARRAY({prop: "value"}) AS isArray5,   
 IS_ARRAY([1, 2, 3]) AS isArray6,  
 IS_ARRAY({prop: "value"}.prop2) AS isArray7  

下面是结果集。Here is the result set.

[{"isArray1":false,"isArray2":false,"isArray3":false,"isArray4":false,"isArray5":false,"isArray6":true,"isArray7":false}]

备注Remarks

此系统函数将从范围索引中获益。This system function will benefit from a range index.

后续步骤Next steps