-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetItem.js
21 lines (19 loc) · 847 Bytes
/
GetItem.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#getItem-property */
/* ===================== GetItem ===================== */
var params = {
TableName: 'table_name',
Key: { // a map of attribute name to AttributeValue for all primary key attributes
attribute_name: attribute_value, //(string | number | boolean | null | Binary)
// more attributes...
},
AttributesToGet: [ // optional (list of specific attribute names to return)
'attribute_name',
// ... more attribute names ...
],
ConsistentRead: false, // optional (true | false)
ReturnConsumedCapacity: 'NONE', // optional (NONE | TOTAL | INDEXES)
};
dynamodb.getItem(params, function(err, data) {
if (err) console.error(err); // an error occurred
else console.log(data); // successful response
});