Reputation: 3697
Simple question, that I'm having hard time googling. Using cypher
via node-neo4j
, I want to run some logic after query, but only if my MERGE
created node (i.e ON CREATE
inside query was triggered), not matched it. How can I achieve this?
Upvotes: 3
Views: 47
Reputation: 10856
You could have created_at
and matched_at
fields with MERGE
and then check them for equality when you return the object:
MERGE (f:Foo)
ON CREATE SET f.created_at = timestamp()
ON MATCH SET f.matched_at = timestamp()
RETURN f
Upvotes: 2