Antoine
Antoine

Reputation: 946

How to pass parameters to apoc.atomic.update?

For example, I would like to perform the following query:

with a, b:
    call apoc.atomic.update(a, "x", "b.x")

However, this fails due to the internal conversion of the update string to

WITH $container as n with n set n.x=b.x

which makes b undefined. Is it possible to pass b as a parameter?

(I know that this particular update may be achieved by with a, b set a.x = b.x)

Upvotes: 0

Views: 85

Answers (1)

Charchit Kapoor
Charchit Kapoor

Reputation: 9284

You will have to fetch and send the value property value, like this:

with a, b:
call apoc.atomic.update(a, "x", toString(apoc.map.get(properties(b), "x")))

Upvotes: 1

Related Questions