I have a bucket in couchbase which has many documents for example
{
"id":"1",
"isAvailable": false
},
{
"id":"2",
"isAvailable": false
},
{
"id":"3",
"isAvailable": true
},
{
"id":"4"
}
Now I want to iterate through all the document in this bucket and check if this document has isAvailable: false. If yes then I need to update that document's isAvailable: true.
I think an UPDATE
statement would work for you.
Something like:
UPDATE mybucket SET isAvailable = true
"check if this document has isAvailable: false" I don't think you don't need to check if isAvailable
is false, since you're just setting all of the isAvailable to true.
If you want to just verify that isAvailable is actually in the document (no matter what its value is), you can do something like this:
UPDATE mybucket
SET isAvailable = true
WHERE isAvailable IS NOT MISSING