Remove null values from an array in a UDF

What is the allAllergens v4 index definition? It looks like you are only checking if the first value defined in the v4 index is a string. Are you not concerned about the second value? And is it the same order as the values defined in the v10 definition? Just making sure :slight_smile:

You might try something like this as a v10 equivalent:

Allergens.allAllergens()
  .fold([], (acc, val) => acc.concat(val.allergens).concat(val.potential_allergens))
  .where(a => a isa String)
  .distinct()

See docs for the isa operator. Operators - Fauna Docs

And this related topic regarding that fold operation: