Reputation: 203
I want to compare two lists in order to find the values in the first list which are not in the second and return them. thanks in advance guys the code returns: Filter is no longer supported is there any alternative way to do this
MATCH (cu:Customer{name: "myCustomer"})-[pu:PURCHASED]->(o:Order)-[*]->(cat:Category)
MATCH (b:Book)-[:IS_a]->(cat)
WITH COLLECT(DISTINCT pu.ISBN) AS purchasedbooks,COLLECT(DISTINCT b.ISBN) AS booksFromTheSameCategory
RETURN FILTER( n IN booksFromTheSameCategory WHERE NOT n IN purchasedbooks ) as listC
Upvotes: 2
Views: 3249
Reputation: 67044
You can use the list comprehension syntax instead of the obsolete filter
function:
MATCH (cu:Customer{name: "myCustomer"})-[pu:PURCHASED]->(o:Order)-[*]->(cat:Category)<-[:IS_a]-(b:Book)
WITH COLLECT(DISTINCT pu.ISBN) AS purchasedbooks, COLLECT(DISTINCT b.ISBN) AS booksFromTheSameCategory
RETURN [n IN booksFromTheSameCategory WHERE NOT n IN purchasedbooks] as listC
You can see Cypher syntax change documentation on this page.
Upvotes: 8