我使用Node.js的如何获取aws-dynamoDB中的所有字段?
var AWS = require('aws-sdk');
AWS.config.update({
region: "region",
endpoint: "https://dynamodb.region.amazonaws.com"
});
var dynamodb = new AWS.DynamoDB();
var params = {
TableName: "acc_new"
};
dynamodb.describeTable(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(JSON.stringify(data));
});
输出:
{ AttributeDefinitions: [ { AttributeName: 'Id', AttributeType: 'S' } ],
TableName: 'acc_new',
KeySchema: [ { AttributeName: 'Id', KeyType: 'HASH' } ],
ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 } }
输出由具有表,并不是所有的属性相关联的唯一关键模式(仅哈希和范围键)。我想获取表中与数据关联的所有属性。
像:
{ AttributeName: 'AccountName', AttributeType: 'S' }
{ AttributeName: 'CreatedBy', AttributeType: 'S' }
...
...
有没有什么办法让一个dynamoDb表的内容,它的所有数据字段。
不,没有。请参阅[this](https://stackoverflow.com/a/20919174/3770040)回答。 –
[以编程方式发现AWS DynamoDB表的所有属性?](https://stackoverflow.com/questions/20919012/discovering-all-attributes-of-a-aws-dynamodb-table-programmatically) –