apoc.coll.insertAll
Syntax |
|
||
Description |
Inserts all of the values into the |
||
Arguments |
Name |
Type |
Description |
|
|
The list to insert the values into. |
|
|
|
The position in the list to start inserting the given values. |
|
|
|
The values to be inserted. |
|
Returns |
|
Usage examples
The following examples insert the values 11
, 12
, and 13
at index 3
in the list using both APOC and Cypher:
apoc.coll.insertAll
WITH [1,3,5,7,9] AS originalList, [11,12,13] AS listToInsert, 3 AS index
RETURN apoc.coll.insertAll(originalList, index, listToInsert) AS output
Using Cypher’s list concatenation
WITH [1,3,5,7,9] AS originalList, [11,12,13] AS listToInsert, 3 AS index
RETURN originalList[0..index] + listToInsert + originalList[index..]
Output |
---|
[1, 3, 5, 11, 12, 13, 7, 9] |