我正在尝试在neo4j上实现触发器,以在更改单个属性时执行
CALL apoc.trigger.add('setUpdated-reference','
UNWIND apoc.trigger.propertiesByKey({assignedNodeProperties}, "reference") AS prop
WITH prop.node AS n, timestamp() as ts
CALL apoc.create.setProperty(n, "updated", ts) YIELD node
CALL apoc.log.info("setUpdated node %s", node)
RETURN null
', {phase:'after'});
但是当我执行
MATCH (n:Currency) WHERE n.Name = "USD" SET n.reference = 1;
查询执行被堆积而日志中没有活动 因此我无法确定这种行为的原因
欢迎任何建议
注意:我也尝试过使用SET方法
CALL apoc.trigger.add('setUpdated2-reference','
UNWIND apoc.trigger.propertiesByKey({assignedNodeProperties}, "reference") AS prop
WITH prop.node AS n, timestamp() as ts
SET n.updated = ts
WITH n AS node
CALL apoc.log.info("setUpdated node %s", node)
RETURN null
', {phase:'after'});