apoc.coll.insert

Details

Syntax

apoc.coll.insert(coll, index, value)

Description

Inserts a value into the specified index in the LIST<ANY>.

Arguments

Name

Type

Description

coll

LIST<ANY>

The list to insert a value into.

index

INTEGER

The position in the list to insert the given value.

value

ANY

The value to be inserted.

Returns

LIST<ANY>

Usage examples

The following inserts the value 11 at index 3 in the list:

RETURN apoc.coll.insert([1,3,5,7,9], 3, 11) AS output;
Results
Output

[1, 3, 5, 11, 7, 9]