apoc.coll.remove

This function is deprecated. Use Cypher’s coll.remove() function instead.

Details

Syntax

apoc.coll.remove(coll, index [, length ])

Description

Removes a range of values from the LIST<ANY>, beginning at position index for the given length of values.

Arguments

Name

Type

Description

coll

LIST<ANY>

The list to remove values from.

index

INTEGER

The starting index in the list to begin removing values from.

length

INTEGER

The number of values to remove. The default is: 1.

Returns

LIST<ANY>

Usage examples

The following removes the item at index 4 using both APOC and Cypher:

apoc.coll.remove
RETURN apoc.coll.remove([1,3,5,7,9], 4) AS output;
Using Cypher’s coll.remove
RETURN coll.remove([1,3,5,7,9], 4) AS output;
Results
Output

[1, 3, 5, 7]

The following removes 2 values, starting from index 1 using both APOC and Cypher:

apoc.coll.remove
RETURN apoc.coll.remove([1,3,5,7,9], 1, 2) AS output;
Using Cypher’s coll.remove
RETURN coll.remove(coll.remove([1,3,5,7,9], 1), 1) AS output;
Results
Output

[1, 7, 9]