I am having a bit of difficulty knowing how to define a procedure using apoc.custom.declareProcedure / apoc.custom.asProcedure that modifies a node and returns nothing (void):
CALL apoc.custom.declareProcedure(
'updateNodeMetadata(node::NODE) :: VOID',
'WITH datetime.realtime() AS now, $node AS node, $node.objectVersion AS oldVersion
SET node.lastChangedAt = now
SET node.objectVersion = CASE WHEN oldVersion IS NULL THEN 1 ELSE oldVersion + 1 END',
'write');
I want to take a node as an argument, and modify a couple of metadata fields on the node.
When I look at the logs for why this fails, the logs say the following, but the function *is* defined as VOID already?
022-08-10 11:30:25.579+0000 ERROR [a.c.CypherProcedures] [neo4j] Could not register procedure: custom.updateNodeMetadata with WITH datetime.realtime() AS now, $node AS node, $node.objectVersion AS oldVersion
SET node.lastChangedAt = now
SET node.objectVersion = CASE WHEN oldVersion IS NULL THEN 1 ELSE oldVersion + 1 END RETURN
accepting[node = null :: NODE?] resulting in [] mode WRITE Procedures with zero output fields must be declared as VOID
org.neo4j.internal.kernel.api.exceptions.ProcedureException: Procedures with zero output fields must be declared as VOID