5.9 · Lesson

Unwinding Lists

You have learned that in a query, you can create lists of Full definition for node (opens in a new tab)A vertex in a graph. In a property graph it can carry labels and properties., strings, or numbers using collect(). Sometimes it is useful to collect elements as intermediate results that are passed on to a later part of a query. For example, the graph you are working with contains languages and countries lists for each Movie node. If you wanted to refactor the graph to create a Language node and associate it with any Movie node that had that particular language in its languages list, you could unwind the list to access each element in the list.

UNWIND returns a row for each element of a list.