【发布时间】:2015-11-30 22:23:03
【问题描述】:
在使用 AWS Javascript SDK 对 dynamo 表执行 updateItem 操作时,我看到第二行使用相同的主键编写,这似乎与文档相反。
我正在使用哈希字符串键“user_id”。
初写:
var params = {
Item: {
user_id : {S: "foo"},
is_authorized: {BOOL: false},
},
TableName: 'MyTable'
};
db.putItem(params, function(err, data){
if(err){
console.log(err);
}else{
console.log(data);
}
});
更新尝试
var updateParams = {
Key: {
user_id : {S: "foo"},
},
AttributeUpdates: {
confirmationCode: {Action: "PUT", Value: {S: "key"}},
phone: {Action: 'PUT', Value: {S: "1234567}},
is_authorized: {Action: 'PUT', Value: {BOOL: false}},
confirmAttempts: {Action: 'PUT', Value: {N: "1"}}
},
TableName: 'MyTable'
};
db.updateItem(params, function(err, data){
if(err){
response = err;
console.log("The error was: " + err);
}else{
response = data;
console.log(data);
}
});
【问题讨论】:
-
能否附上bug截图?