Containing all
Learn how to check if a collection contains all elements of another.
This operator checks whether one collection contains all elements of another. It is the opposite of the containing none operator.
Note that the result is always true if the second collection is empty, because the empty set is a subset of every set.
Also, keep in mind that neither the order nor duplicate elements affect the result since collections are treated as sets.
You can combine conditions to create more advanced criteria.
Syntax
The basic syntax is:
with /*<name>*/ containing all of /*<collection>*/
Alternatively, you can use the including keyword:
with /*<name>*/ including all of /*<collection>*/
The negation of this operation can be expressed as:
with /*<name>*/ not containing all of /*<collection>*/
Using the alternative syntax:
with /*<name>*/ not including all of /*<collection>*/
Parameters
These are the supported parameters:
- name
The name of the event property to search for in the collection.
- collection
The collection to check.
Examples
Check if a product was abandoned with two specific categories:
user has viewed post with tags containing all of ["sport", "summer"]
Or to check the opposite:
user has viewed post with tags not containing all of ["sport", "summer"]