I would like to suggest that in the next version of APOC a new function could be implemented which checks, if a certain node with a specific value in a property exists or not.
Thank you Michael, two users of the community (I don't know how to mention them here) have already found a solution in another thread (I don't know how to link there).
exits() is a predicate function, which might be deprecated at some point.
And exists {} is more like a structural clause, also called existential subquery, so like a subquery but one that only returns false/true on zero/non-zero results of the query (which currently can contain match/where)
Unfortunately, I'm at the stage of where Cypher is like Legos: I can build fragments but I can't always build an entire structure that I want. I'm beginning to understand subqueries (which I believe don't get enough emphasis) but I'm not fully there... I don't understand why I'm not allowed to put certain pieces together in certain ways that I would have thought possible.
I naively tried this:
RETURN exists { MATCH (u:User {name: "abc@xyz.at"}) }
but I got this error msg...
The EXISTS subclause is not valid inside a WITH or RETURN clause. (line 1, column 9 (offset: 8))
"RETURN exists {MATCH (u:User {name: "abc@xyz.at"})}"
^
I do see the exist subquery documentation, but it doesn't match up with what I (and the OP) would like to do.
I also tried this: I'd like to do an existing test within apoc.when but this doesn't seem to work either. It seems that Cypher is insisting on having a relationship pattern but I just want to test for existence of a node with a certain property's value.