Update thousands of jsons


#1

Hello,

I have 100k JSON documents in a bucket called mybucket; Those jsons have the following structure;
{
“userID”:“1”,
“Type”:“user”,
“username”:“test1”
}

I want to update those 100k documents by adding a new field called status with a value 1; something like the following

{
“userID”:“1”,
“Type”:“user”,
“username”:“test1”,
“status”:“1”
}
How can I do it?
Thanks
W


#2

UPDATE my_bucket
SET status = 1;


#3

@geraldss Thanks , does the explain plan works for the updates also?

cbq> EXPLAIN UPDATE mybucket SET col1 = 1 WHERE col2 IN( “col_138184” ,“col_135425”,“col_135511”) ;
{
“requestID”: “c212d0b2-a51d-48b4-8a73-adcbc01a9a89”,
“errors”: [
{
“code”: 3000,
“msg”: “syntax error - at ,”
}
],
“status”: “fatal”,
“metrics”: {
“elapsedTime”: “1.431701ms”,
“executionTime”: “768.882µs”,
“resultCount”: 0,
“resultSize”: 0,
“errorCount”: 1
}
}

cbq>


#4

Use square brackets for IN: