แก้ไข

แชร์ผ่าน


ARRAY_CONTAINS_ALL (NoSQL query)

APPLIES TO: NoSQL

Returns a boolean value indicates if the first array contains all the following elements.

Syntax

ARRAY_CONTAINS_ALL(<array_expr>, <expr> [, exprN])

Arguments

Description
array_expr An array expression.
expr Expression to search for within the array.
exprN (Optional) One or more extra expressions to to search for within the array.

Return types

Returns a boolean value.

Examples

The following example illustrates how to check for specific values or objects in an array using this function.

SELECT VALUE {
  matchesEntireArray: ARRAY_CONTAINS_ALL([1, true, "3", [1,2,3]], 1, true, "3", [1,2,3]),
  matchesSomeValues: ARRAY_CONTAINS_ALL([1, 2, 3, 4], 2, 3, 4, 5),
  matchSingleValue: ARRAY_CONTAINS_ALL([1, 2, 3, 4], 1, undefined),
  noMatches: ARRAY_CONTAINS_ALL([1, 2, 3, 4], 5, 6, 7, 8),
  emptyArray: ARRAY_CONTAINS_ALL([], 1, 2, 3),
  noMatchesUndefined: ARRAY_CONTAINS_ALL([1, 2, 3, 4], 5, undefined)
}
[
  {
    "matchesEntireArray": true,
    "matchesSomeValues": false,
    "noMatches": false,
    "emptyArray": false,
    "noMatchesUndefined": false
  }
]

Remarks

  • This system function doesn't utilize the index.