mercredi 1 avril 2015

How create a table on DynamoDB with a GlobalSecondaryIndexes in local?

I DynamoDB install locally on Windows 7. My project is a Node.js(0.12.0) and I use aws-sdk.


Version DynamoDB : 2012-08-10


This work ->



dynamodb.createTable({
TableName: 'Users',
AttributeDefinitions: [{AttributeName: 'userId', AttributeType: 'S'}],
KeySchema: [{AttributeName: 'userId', KeyType: 'HASH'}],
ProvisionedThroughput: {
'ReadCapacityUnits': 5,
'WriteCapacityUnits': 5
}
}, function () {
...
});


This don't work ->



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 () {
...
});


Doc DynamoDB Javascript : http://ift.tt/1F4tD4x





Aucun commentaire:

Enregistrer un commentaire