neo4j / apoc

Apache License 2.0
81 stars 27 forks source link

Problems in the execution of trigger #642

Closed chrisoraruf closed 1 month ago

chrisoraruf commented 1 month ago

Hello guys, I am facing a really bizzarre problem and I am trying to understand why. I am trying to build a straightforward example of a trigger that detects the modification of some properties inside the nodes and, when it happens, checks to which Document the node belongs to (there is a node of type Document) and set some properties on the document.

Result when a modification applies to a node? Absolutely nothing, if we consider the Document.

Here the easy example, just a minor adaptation of what we can find in the neo4j examples

CALL apoc.trigger.install('neo4j', 'setDocumentUpdate', "UNWIND keys($assignedNodeProperties) AS k UNWIND $assignedNodeProperties[k] AS map WITH map.node AS node, collect(map.key) AS propList MATCH (n)-[:BELONGS_TO]->(doc:Document) WHERE id(n) = id(node) SET doc.time = date(), doc.modified = 'true'", {phase: 'afterAsync'})

Does somebody have a suggestion of what the cause of no modification to Document can be?

Christian

p.s. since I notice that a similar trigger is working just fine with a smaller database, for example in the one example given in https://neo4j.com/labs/apoc/4.4/background-operations/triggers/#_triggers_examples, do you think that the size of the database in a problem? The number of nodes is around 15000, but to me this trigger looks pretty simple as it just selects the document the node belongs to (the node belongs to just one document) and then set some properties to it.