Skip to content

Instantly share code, notes, and snippets.

@hemc4
Created June 14, 2014 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hemc4/f020b8395a2f9a603fa9 to your computer and use it in GitHub Desktop.
Save hemc4/f020b8395a2f9a603fa9 to your computer and use it in GitHub Desktop.
Node.js AWS DynamoDb Scan Example
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./aws.config.json');
var dd = new AWS.DynamoDB();
var tableName = 'session';
var keyName='id';
function getSession() {
var db = new AWS.DynamoDB();
db.client.scan({
TableName : tableName,
Limit : 1
}, function(err, data) {
if (err) {
console.log(err); return;
}
for (var ii in data.Items) {
ii = data.Items[ii];
console.log(ii.id);
console.log(ii.data);
}
});
}
getSession();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment