sab*_*bir 3 node.js amazon-dynamodb
在我的dynamoDB中,我有一个表,其结构如下所示:
var params = {
"TableName" : "pdfs",
"Item" : {
pdfid: // Partition key
html: [] // array attribute
}
};
Run Code Online (Sandbox Code Playgroud)
我可以插入新的数组数据,就像给定的代码一样:
插入数组数据
var params = {
"TableName" : "pdfs",
"Item" : {
pdfid: pdfid,
html: [event.html] // here "html" is an array, I just insert first array data
}
};
dc.put(params, function(err, data) {
............................
});
Run Code Online (Sandbox Code Playgroud)
如何更新数组dynamoDB?
var params = {
TableName: "pdfs",
Key: {
pdfid: event.pdfid
},
UpdateExpression: "SET html = :html",
ExpressionAttributeValues: {
":html": ??????
},
ReturnValues: "ALL_NEW"
};
Run Code Online (Sandbox Code Playgroud)
使用以下 UpdateExpression 将值附加到列表:SET html = list_append(html, :html)。:htmlExpressionAttributeValues 只是到您要添加的字符串的映射。
| 归档时间: |
|
| 查看次数: |
7354 次 |
| 最近记录: |