这是我的代码.
我想将asset_datajson插入asset_data列中.我正在使用aws sdk.它说aws sdk现在支持json.
http://aws.amazon.com/releasenotes/SDK/JavaScript/1691866671551861
var asset_data = {
"name": "name" + i,
"contentUrl": "http://www.hdwallpapersimages.com/nature-beauty-desktop-images/94892/",
"size": 300,
"headline": "headline",
"description": "assetUrl reference for the creator",
"encodingFormat": 'jpeg'
};
var params = {
TableName: 'xyz',
Item: { // a map of attribute name to AttributeValue
"asset_id": {S: "asset" + i},
"hit_id": {S: "0"},
"created_date": {"S": Date.now().toString()},
"status": {N: "0"},
"operation": {S: "image_tagging"},
"asset_data": {L: asset_data},
"source": {S: "DAM"},
"completed_date": {S: Date.now().toString()},
"response_data": {S: "taged value"}
// more …Run Code Online (Sandbox Code Playgroud) 我们如何基于索引(而不是基于主键has和range键)更新dynamodb表。
我有一个按名称创建的索引key_id-index
,哈希为asset_id,范围为hit_id。我想基于更新表,key_id-index因为更新时我不知道这些。
var paramsu = {
TableName: 'asset',
//IndexName: 'key_id-index',
Key: { // The primary key of the item (a map of attribute name to AttributeValue)
asset_id: { S: 'a' },
hit_id: { S: 'h' }
// more attributes...
},
AttributeUpdates: { // The attributes to update (map of attribute name to AttributeValueUpdate)
key_id: {
Action: 'PUT', // PUT (replace)
// ADD (adds to number or set)
// DELETE (delete attribute or …Run Code Online (Sandbox Code Playgroud)