Apologies if this has already been asked, but I was unable to find the answer
I would like to error when trying to create a relationship between nodes, where one or both of the nodes do not exist
For example, the following code just returns no results, but I would like it to raise an error to let me know that these nodes do not exist, so that I can surface that error to my application:
MATCH (user1: User{uuid: '123'}), (user2: User{uuid: '456'})
CREATE (user1)-[:LIKES]->(user2)
Please assume that the database is empty and therefore no nodes were matched
I tried to add a constraint, but I didn't know how to approach it and if this is possible - are you able to help please?