apoc.coll.flatten

Function APOC Core

apoc.coll.flatten(coll, [recursive]) - flattens list (nested if recursive is true)

Signature

apoc.coll.flatten(coll :: LIST? OF ANY?, recursive = false :: BOOLEAN?) :: (LIST? OF ANY?)

Input parameters

Name Type Default

coll

LIST? OF ANY?

null

recursive

BOOLEAN?

false

Usage Examples

The following flattens a collection of collections:

RETURN apoc.coll.flatten([1,2,3,[4,5,6]]) AS output;
Table 1. Results
Output

[1, 2, 3, 4, 5, 6]