apoc.coll.flatten

Function

apoc.coll.flatten(coll LIST<ANY>, recursive BOOLEAN) - flattens the given LIST<ANY> (to flatten nested LIST<ANY> values, set recursive to true).

Signature

apoc.coll.flatten(coll :: LIST<ANY>, recursive = false :: BOOLEAN) :: LIST<ANY>

Input parameters

Name Type Default

coll

LIST<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]