isSuperset - Check if one array contains another array
isSuperset
returns true
if array1
is a superset of array2
.
NOTE: When comparing array1
and array2
, duplicates will be discarded. This means two arrays of differing lengths but the same unique elements will be considered equal.
Syntax
Arguments
Name | Type | Required | Description |
---|---|---|---|
array1 | array of type T | true | T must be either string , bool , number , interval , timestamp , regexp or enum |
array2 | array of type T | true | T must be either string , bool , number , interval , timestamp , regexp or enum |
Example - Basic usage
Consider the following document:
If we wish to check that all_jobs
is a superset of started_jobs
, we can do the following:
This results in the following document:
{
"all_jobs": ["Chris", "John", "Adam", "Ariel", "Zev"],
"started_jobs": ["Chris", "John"],
"is_superset": true
}
Theme
Light