So i have a dynamodb table called tableX with the fields:
random_fld1, random_fld2, primary_key1, and sort_key1
all fields are Strings.
What would be a getItem example with those keys and fields. I haven't been able to get the Keys: portion working with getItem.
You can use DynamoDB's DocumentClient get() as:
'use strict';
const AWS = require('aws-sdk');
const docClient = new AWS.DynamoDB.DocumentClient({ apiVersion: '2012-08-10' });
var params = {
TableName: 'tableX',
Key: {
'primary_key1': 'PARTITION_KEY_VALUE',
'sort_key1': 'SORT_KEY_VALUE'
}
};
docClient.get(params, function(err, data) {
if (err) console.log(err);
else console.log(data);
});
See the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With