How do I update a field for a nested array json input?
Works fine in N1QL, but not able to create using java api.
UPDATE bucketName
as myBucket SET enroll.status=‘INACTIVE’ FOR enroll IN app.enrollList FOR app IN myBucket.apps when enroll.deviceInfo.deviceId=‘deviceId1002’ end
{
“apps”: [
{
“enrollList”: [
{
“deviceInfo” : {
},
status: “active”
}
]
}
]
}
Was finally able to resolve using the below, Is this the only alternative?
update(i(bucket.name()).as(“myBucket”))
.set(path(“enroll.status”), s(“INACTIVE”),
x(“FOR enroll IN app.enrollList FOR app IN myBucket.apps when enroll.deviceInfo.deviceId=‘DeviceId’ end”));
java client version: 2.4.5