I want to return a unique list of product options in AQL, I understand COLLECT can return unique list however, how do I now flatten it into an array.
So I want to return the following filtered list: (lets call it list [A])
[
[
"Size"
],
[
"Size",
"Color"
],
[
"value"
]
]
as: (lets call this list [B])
["Size","Color","Value"]
Query used to obtain list [A]
FOR product IN products
COLLECT options = product.options[*].option
FILTER LENGTH( options ) > 0
RETURN options
I tried FLATTEN, UNIQUE and no luck. Perhaps am not using functions accurately. My initial thought would be to repack items in list [A] to create list [B] something like push [A] into [B] if not in [B]