apoc.coll.toSet

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

Details

Syntax

apoc.coll.toSet(coll)

Description

Returns a unique LIST<ANY> from the given LIST<ANY>.

Arguments

Name

Type

Description

coll

LIST<ANY>

The list of values to remove all duplicates from.

Returns

LIST<ANY>

Usage examples

The following converts a list to a set:

apoc.coll.toSet
RETURN apoc.coll.toSet([1,1,2,1,3,4,1]) AS output;
Using Cypher’s coll.distinct
RETURN coll.distinct([1,1,2,1,3,4,1]) AS output;
Results
Output

[1, 2, 3, 4]