neo4j how to compare two list and return the different items

Viewed 4121

I am using neo4j MATCH and get two list of User: listA,listB, and listB is part of listA
how can I return users only in listA but not in listB use cipher query
the cipher like :

MATCH listA, listB
RETURN listA - listB

Here is my previous question: neo4j cypher multi relationship between nodes

Done See solution in the link above

2 Answers

Filter function is removed in the latest Neo4j version 4.0 doc here instead, use List comprehension

WITH [1,2,3,4,5,6] as listA, [1,2,3] as listB
RETURN [n IN listA WHERE NOT n IN listB] as listC

This results in an output 4, 5, 6

Related