age
age copied to clipboard
Mandatory Match
The MANDATORY MATCH clause, a variant of MATCH, forces a match in cases where there is an expectation of matching at least one node complying with a given pattern. If no match is found, the query will fail.
Introduction MANDATORY MATCH matches patterns against the graph database, just like MATCH does. The difference is that if no matches are found, the query will fail.
When writing applications using Cypher, many queries will start off by looking up multiple individual nodes based on an unique id with the implied expectation of matching exactly one node. When that expectation is not fulfilled (either due to sending a wrong id or the node having been deleted) it becomes important to identify which lookup failed. Achieving this currently is not well supported by Cypher. A frequent use case in many applications is one in which there is an expectation that a particular node, identified by some unique id, exists in the graph. This node is usually used as a starting point, from which traversals are undertaken to retrieve related information.
Add the Keyword Mandatory before Match
Note: needs to be rebased and formatted
@JoshInnis any progess on this?