I have a custom function defined like:
CALL apoc.custom.asFunction('fn', "MATCH ...
RETURN stuff", 'NODE', [['param1', 'STRING']], false, 'docstring')
It's supposed to return a matched node by some criteria. When I run CALL custom.fn("something")
The returned result I'm seeing is
{
"stuff": {
"identity": 1,
"labels": [
"Target"
],
"properties": {
"value": 2
}
}
}
but I can't seem to get rid of that extra level of nesting "stuff" and just get
{
"identity": 1,
"labels": [
"Target"
],
"properties": {
"value": 2
}
}
How could I get rid of it? It's really a nuisance when trying to use custom function e.g.
WITH custom.fn("something") as x
MATCH (x)-[r]->(y)
RETURN x, r, y
I get the error
Expected to find a node at 'x' but found Map{stuff -> (1)} instead
and I have to do tricky thing to lookup by x.stuff
instead. I just want return value directly to be the node.