"Contains ALL of" array filtering logic

I have a large object type (>2m rows) with an array property that I want to filter in Workshop. I also have an array of string values in Workshop (based off of another object set) that I want to filter the array property with.

However, the filtering logic I want to use is “contains ALL of” which is not an option when filtering an object set. I have also tried to use the ‘filter list’ widget to produce a filter output that I can apply to my object set definition, but the filtering logic is still that of “ANY/OR” rather than “ALL/AND”.

Ideally this would be done in a function, but the large object size prohibits that. I tried to “pre-filter” the object using the “contains ANY of” filter in Workshop, then a “contains ALL of” filter (in a function) but due to the varying length of the array of string values this will often surpass the object size limit of 100k.

Any ideas or workarounds are appreciated, thanks in advance!

I don’t think there should be any issues with passing an object set of 2 million objects to a function as it will pass a reference to the set instead of the materialized list of objects.

import { Function, Filters } from "@foundry/functions-api";
import { MyObjectType, ObjectSet } from "@foundry/ontology-api";

...


@Function()
public myFunction(filterValues: string[], objects: ObjectSet<MyObjectType>): ObjectSet<MyObjectType> {
     return objects.filter(
            obj => Filters.and(
                ...filterValues.map(f => obj.arrayProperty.contains(f))
            )
     )
}

You can then filter to the objects that contain all values in your array like such.