Posts

Showing posts from August, 2015

DynamoDB for Javascript – cheatsheet

The following snippets can be used for interacting with AWS DynamoDB using AWS Javascript API. PutItem var params = { TableName: 'table_name', Item: { // a map of attribute name to AttributeValue attribute_name: { S: 'STRING_VALUE' } // more attributes... }, Expected: { // optional (map of attribute name to ExpectedAttributeValue) attribute_name: { Exists: true, // optional (if false, Value must be null) Value: { S: 'STRING_VALUE' }, }, // more attributes... }, ReturnValues: 'NONE', // optional (NONE | ALL_OLD) ReturnConsumedCapacity: 'NONE', // optional (NONE | TOTAL | INDEXES) ReturnItemCollectionMetrics: 'NONE', // optional (NONE | SIZE) }; dynamodb.putItem(params, function(err, data) { if (err) console.log(err); // an error occurred else console.log(data); // successful response }); UpdateItem var params = { Ta...