cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

use of 'after' phase in trigger

suvi
Node Link

with reference to the:  Solved: Freezed query after implemented AFTER trigger - Neo4j - 14059  , I understood that we should not use 'after' phase selector while creating a trigger for a 'create' event.
I was trying to create a trigger. Which is:

CALL apoc.trigger.add('updateLabela',"UNWIND apoc.trigger.nodesByLabel($removedLabels,'Actor') AS node
MATCH (n:Actor)
REMOVE n:Actor SET n:Person SET node:Person", {phase:'after'})
 basically it's a trigger for update event.
This works fine for 'before' phase, but for 'after' phase the queries never get terminated.

So, now I wonder what are the restrictions on using 'after' phase while creating triggers, what are the cases where we can use 'after' phase and where can we use other phases viz. 'before', 'rollback' and 'afterAync'.

Thank you.
 
2 REPLIES 2

As the tx is about to be committed doing updates on the graph in that phase might mess up the tx state,

better use afterAsync or before for that.

suvi
Node Link

Where can we use 'after' phase?