apoc.coll.insert

Function

apoc.coll.insert(coll [Any], index Integer, value Any) - inserts a value into the specified index in the list.

Signature

apoc.coll.insert(coll :: LIST? OF ANY?, index :: INTEGER?, value :: ANY?) :: (LIST? OF ANY?)

Input parameters

Name Type Default

coll

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