apoc.coll.flatten

Details

Syntax

apoc.coll.flatten(coll [, recursive ])

Description

Flattens the given LIST<ANY> (to flatten nested LIST<ANY> values, set recursive to true).

Arguments

Name

Type

Description

coll

LIST<ANY>

The list to flatten.

recursive

BOOLEAN

Whether nested list items should also be flattened. The default is: false.

Returns

LIST<ANY>

Usage examples

The following flattens a collection of collections:

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

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