作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 Windows 7 上本地安装 DynamoDB。我的项目是 Node.js(0.12.0),我使用 aws-sdk。
DynamoDB 版本:2012-08-10
这项工作 ->
dynamodb.createTable({
TableName: 'Users',
AttributeDefinitions: [{AttributeName: 'userId', AttributeType: 'S'}],
KeySchema: [{AttributeName: 'userId', KeyType: 'HASH'}],
ProvisionedThroughput: {
'ReadCapacityUnits': 5,
'WriteCapacityUnits': 5
}
}, function () {
...
});
这行不通 ->
dynamodb.createTable({
TableName: 'Users',
AttributeDefinitions: [{AttributeName: 'userId', AttributeType: 'S'}],
KeySchema: [{AttributeName: 'userId', KeyType: 'HASH'}],
ProvisionedThroughput: {
'ReadCapacityUnits': 5,
'WriteCapacityUnits': 5
},
GlobalSecondaryIndexes: [
{
IndexName: 'longitudeUserIndex',
KeySchema: [
{
AttributeName: 'userId',
KeyType: 'HASH'
},
{
AttributeName: 'longitude',
KeyType: 'RANGE'
}
],
Projection: {
NonKeyAttributes: [
],
ProjectionType: 'KEYS_ONLY'
},
ProvisionedThroughput: {
'ReadCapacityUnits': 5,
'WriteCapacityUnits': 5
}
}
]
}, function () {
...
});
DynamoDB Javascript 文档:http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#createTable-property
最佳答案
我解决了我的问题。
我在 AttributeDefinitions 中添加了经度。
AttributeDefinitions: [{AttributeName: 'userId', AttributeType: 'S'}, {AttributeName: 'longitude', AttributeType: 'N'}]
关于javascript - 如何在本地使用 GlobalSecondaryIndexes 在 DynamoDB 上创建表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29402503/
我在 Windows 7 上本地安装 DynamoDB。我的项目是 Node.js(0.12.0),我使用 aws-sdk。 DynamoDB 版本:2012-08-10 这项工作 -> dynamo
我正在尝试编写一个云形成模板,其中 DynamoDBTable 的全局二级索引 (GSI) 名称可用作 AWS Lambda 中的环境变量。我有下面的模板,但无法获取对 AWS Lambda 中的 G
我是一名优秀的程序员,十分优秀!