我们如何根据索引更新dynamodb表(不是基于主键和范围键)
如何根据索引更新dynamodb表(不是基于主键和范围键)。
我有一个由名称key_id-index
index创buildkey_id-index
,hash是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 remove from set) Value: { S: 'updated1' } } // more attribute updates: ... }, ReturnValues: 'NONE', // optional (NONE | ALL_OLD | UPDATED_OLD | ALL_NEW | UPDATED_NEW) ReturnConsumedCapacity: 'NONE', // optional (NONE | TOTAL | INDEXES) ReturnItemCollectionMetrics: 'NONE' // optional (NONE | SIZE) }; db.updateItem(paramsu, function(err, data) { if (err) console.log(err); // an error occurred else console.log(data); // successful response });
你不能写信给GSI。
您唯一的select是首先从GSI读取,获取属于您的键的属性值(它们总是投影到索引上,请参阅GSI.Projections ),然后将数据写回表中。
- 如何解决DynamoDB上的Joi错误TypeError:child.schema._getLabel不是函数
- 使用node.js更新expression式上的发电机数据库错误
- DynamoDB,使用AWS Lambda(NodeJS运行时)映射值的dynamicprimefaces更新
- 如何从发电机数据生活图
- 在使用节点JS的DynamoDB查询中recursion提取所有项目
- AWS – 在DynamoDB表中放置一个GeoPoing并对其进行查询 – node.js
- Amazon Web服务DynamoDB请求缓慢
- 如何从AWS DynamoDB – JS lambda中的函数返回查询结果
- dynamodb节点aws-sdk简单getItem()调用