Επεξεργασία

Κοινή χρήση μέσω


IS_PRIMITIVE (NoSQL query)

APPLIES TO: NoSQL

Returns a boolean value indicating if the type of the specified expression is a primitive (string, boolean, numeric, or null).

Syntax

IS_PRIMITIVE(<expr>)  

Arguments

Description
expr Any expression.

Return types

Returns a boolean expression.

Examples

The following example various values to see if they're a primitive.

SELECT VALUE {
    isBooleanAPrimitive: IS_PRIMITIVE(true),
    isNumberAPrimitive: IS_PRIMITIVE(1),
    isStringAPrimitive: IS_PRIMITIVE("value"),
    isArrayAPrimitive: IS_PRIMITIVE([ "green", "red", "yellow" ]),
    isNullAPrimitive: IS_PRIMITIVE(null),
    isObjectAPrimitive: IS_PRIMITIVE({ "name": "Tecozow coat" }),
    isObjectStringPropertyAPrimitive: IS_PRIMITIVE({ "name": "Tecozow coat" }.name),
    isObjectBooleanPropertyAPrimitive: IS_PRIMITIVE({ "onSale": false }.onSale),
    isUndefinedAPrimitive: IS_PRIMITIVE({}.category)
}
[
  {
    "isBooleanAPrimitive": true,
    "isNumberAPrimitive": true,
    "isStringAPrimitive": true,
    "isArrayAPrimitive": false,
    "isNullAPrimitive": true,
    "isObjectAPrimitive": false,
    "isObjectStringPropertyAPrimitive": true,
    "isObjectBooleanPropertyAPrimitive": true,
    "isUndefinedAPrimitive": false
  }
]

Remarks