Rolling back a transaction
In a transaction, all modifications can be rolled back if needed.
To roll back modifications in a transaction, use the following:
GQL:
ROLLBACK
This query undoes all modifications and terminates the transaction.
Here is a complete example of rolling back a transaction:
- Start a transaction:
GQL: START TRANSACTION
The query initiates a transaction.
- Modify the data:
GQL2: MATCH (n) FILTER n.name = "GQL" SET n.year = 2025
This query finds a node named GQL and sets its year property to 2025.
- Roll back the transaction:
GQL3: ROLLBACK
This query rolls back all modifications, reverting the year property of the GQL node to its previous value.
The transaction is terminated upon rollback.