UNWIND clause transforms a list into individual rows, creating one row for each element in the list.
Behavior
- Each element in the list becomes a separate row
- The order of rows preserves the original list order
- Useful for processing lists, creating multiple entities, or parameter expansion
Basic Example
Create a node with an array property:Practical Examples
Create Multiple Nodes from a List
Process Nested Data
Combine with Other Clauses
Frequently Asked Questions
What does UNWIND do?
What does UNWIND do?
UNWIND transforms a list into individual rows, creating one row per element. It is the inverse of the
collect() aggregation function.Can I UNWIND a literal list?
Can I UNWIND a literal list?
Yes. You can unwind inline lists directly:
UNWIND ['Alice', 'Bob'] AS name CREATE (:Person {name: name}). This is useful for batch operations.What happens if I UNWIND an empty list?
What happens if I UNWIND an empty list?
If the list is empty, UNWIND produces zero rows, effectively eliminating that record from the result stream. No subsequent clauses will execute for that record.
Can I UNWIND nested lists or maps?
Can I UNWIND nested lists or maps?
Yes. You can unwind lists of maps and access their properties:
UNWIND [{name: 'Alice'}, {name: 'Bob'}] AS person CREATE (:Person {name: person.name}).