apoc.schema.properties.distinctProcedure
|
Syntax |
|
||
Description |
Returns all distinct |
||
Input arguments |
Name |
Type |
Description |
|
|
The node label to find distinct property values on. If set to ``, the distinct property values for all labels will be found. |
|
|
|
The name of the property to find distinct values of. If set to ``, the distinct property values for the specified label and all property names will be found. |
|
Return arguments |
Name |
Type |
Description |
|
|
The list of distinct values for the given property. |
|
Usage Examples
The examples in this section are based on the following sample graph:
CREATE (:Person {name: "Michael", age: 45});
CREATE (:Person {name: "Ryan", age: 33});
CREATE (:Person {name: "Michael", age: 42});
CREATE (:Dog {name: "Shadow", age: 11});
Specific label and property name
CALL apoc.schema.properties.distinct("Person", "name");
| value |
|---|
["Michael", "Ryan"] |
All labels and specific property name
Setting the input argument label to `` will return the distinct property values for all labels and the specified property name.
CALL apoc.schema.properties.distinct("", "name");
| value |
|---|
["Michael", "Ryan", "Shadow"] |
Specific label and all property names
Setting the input argument key to `` will return the distinct property values for the specified label and all property names.
CALL apoc.schema.properties.distinctCount("Person", "");
| value |
|---|
["Michael", "Ryan", 45, 33, 42] |
All labels and all property names
Setting the input arguments label and key to `` will return the distinct property values for the all labels and property names.
CALL apoc.schema.properties.distinct("", "");
| value |
|---|
["Michael", "Ryan", "Shadow", 45, 33, 42, 11] |
|
In APOC 2025.11, this procedure went through a bigger refactoring including several bug fixes. As a result the behavior has changed compared to previous versions in multiple cases:
|