Bulk UPDATE DML


#1

Hi, i need update collection of users and set new non existing attribute campaign.marketing1

{
“customer_id”: “customer_1”,
“jsonType”: “user”,
“status_id”: 3
}
{
“customer_id”: “customer_2”,
“jsonType”: “user”,
“status_id”: 3
}

This is my update but does not work properly:
UPDATE bucket c SET m.marketing1 = ‘1’ FOR m WITHIN c.campaign WHEN c.jsonType = ‘user’ AND c.campaign IS MISSING AND c.status_id = 3 END;

This is my expected result
{
“customer_id”: “customer_1”,
“jsonType”: “user”,
“status_id”: 3,
“campaign”: { marketing1: “1” }
}
{
“customer_id”: “customer_2”,
“jsonType”: “user”,
“status_id”: 3,
“campaign”: { marketing1: “1” }
}


#2

UPDATE bucket c SET
campaign = {},
campaign.marketing1 = '1’
WHERE campaign IS MISSING AND status_id = 3;


#3

“errors”: [
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
}
],


#4

Hi,

Are you doing concurrent updates? We have fixed the error message in cases where concurrent updates lead to CAS mismatches.

Gerald


#5

No and i restart also couchbase server and right after start execute this UPDATE and error message is always same.


#6

hello,

I have same issue;

cbq> UPDATE test_b SET dateTime = SUBSTR(date_add_str(now_str(), -1, “day”),0,10) where type=“mytype”;
{
“requestID”: “d9c0bcab-6868-4c58-9729-cd25c051bd5c”,
“signature”: null,
“results”: [
],
“errors”: [
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
},
{
“code”: 12009,
“msg”: “DML ErrorFailed to perform update - cause: MCResponse status=KEY_EEXISTS, opcode=SET, opaque=0, msg: Data exists for key”
}
],
“status”: “errors”,
“metrics”: {
“elapsedTime”: “38.882011767s”,
“executionTime”: “38.88183661s”,
“resultCount”: 0,
“resultSize”: 0,
“mutationCount”: 86548,
“errorCount”: 16
}
}


#7

Ok. We are testing a newer build.

Thanks,
Gerald


#8

Do you know when it will be ready ? thanks @geraldss