WITH [
{tagKey: "x", values: ["1", "2", "3", "4"]},
{tagKey: "y", values: ["5", "6", "7", "8", "9"]}
] AS tagData
// Start with an empty list of combinations
WITH tagData, [] AS combinations
// Iterate over each tagKey entry
UNWIND tagData AS tagEntry
WITH tagEntry, combinations
// Unwind the values for the current tagKey
UNWIND tagEntry.values AS value
WITH tagEntry, value, combinations
// Use UNWIND to expand each existing combination with the current value
UNWIND combinations AS combination
WITH combination + [{tagKey: tagEntry.tagKey, value: value}] AS newCombination
// Collect all new combinations
WITH collect(newCombination) AS combinations
// Return each combination
UNWIND combinations AS combination
RETURN combination , i tried this
βcombination β
βββββββββββββββββββββββββββββ‘
β[{tagKey: "x", value: "1"}]β
βββββββββββββββββββββββββββββ€
β[{tagKey: "x", value: "2"}]β
βββββββββββββββββββββββββββββ€