It is sometimes useful to aggregate several rows into a single list of objects. In that case, we will use the following:
COLLECT
For instance, if we want to create a list containing the code of the states sharing a border with Colorado:
MATCH (:State {code: "FL"})-[:SHARE_BORDER_WITH]-(n)
RETURN COLLECT(n.code)
This returns the following result:
["GA","AL"]