Containing either

Learn how to check if a collection contains one or more elements.

This operator checks whether one collection contains at least one element from another. It is the opposite of the containing neither operator.

Note that the result is always false if the second collection is empty because the empty set is disjoint from every set.

Also, keep in mind that neither the order nor duplicate elements affect the result since collections are treated as sets.

Syntax

The basic syntax is:

with /*<property>*/ containing either /*<collection>*/

Alternatively, you can use the including keyword:

with /*<property>*/ including either /*<collection>*/

The negation of this operation can be expressed as:

with /*<property>*/ not containing either /*<collection>*/

Using the alternative syntax:

with /*<property>*/ not including either /*<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 post with one of the specified tags was viewed:

user has viewed post with tags containing either ["news", "cases"]
Try in Playground

To check the opposite:

user has viewed post with tags not containing either ["news", "cases"]
Try in Playground