OBJECT_PUT attr_key param (multi level paths)

(How) Can I pass in a complex path argument to OJBECT_PUT’s attr_key param?

say I have
let x =
{
“toplevel1”: 1,
“toplevel2”:2,
“toplevel3”: {
“secondlevel”: 3
}
}

I want to do OBJECT_PUT(x, ‘toplevel3’.‘secondlevel’, ‘newValue’)

I’ve tried ‘top’.‘next’ and top.next.

Neither seem to work and appear to null out the object (which is an issue in and of itself)

OBJECT_PUT(arg1, arg2, arg3)
arg2 must be identifier not a dotted path.
Depends on where u use you can do this
OBJECT_PUT(x.toplevel3, secondlevel, newValue) The return value will be x.toplevel3 not x
OBJECT_PUT(x, toplevel3, OBJECT_PUT(x.toplevel3, secondlevel, newValue) ) gives x

1 Like

thank you, as usual, clear and pertinent.

can you speak to whether and where update using joins is on the roadmap?

At present you can explore MERGE option (ANSI merge in 6.50 beta).

1 Like

Hi @naftali,

Supporting UPDATE JOIN is planned for future release. I have created https://issues.couchbase.com/browse/MB-37051 to track this.

1 Like