apoc.coll.insert

Function

apoc.coll.insert(coll LIST<ANY>, index INTEGER, value ANY) - inserts a value into the specified index in the LIST<ANY>.

Signature

apoc.coll.insert(coll :: LIST<ANY>, index :: INTEGER, value :: ANY) :: LIST<ANY>

Input parameters

Name Type Default

coll

LIST<ANY>

null

index

INTEGER

null

value

ANY

null

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;
Table 1. Results
Output

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