Created
October 14, 2019 01:02
-
-
Save haigopi/91a500ff0bdc5116af7acee641b6ad27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dynamodb = new AWS.DynamoDB({ | |
region: 'us-east-1', | |
endpoint: "http://localhost:15002" | |
}); | |
var tableName = "default-events"; | |
var params = { | |
TableName: tableName, | |
Select: "ALL_ATTRIBUTES" | |
}; | |
function doScan(response) { | |
if (response.error) ppJson(response.error); // an error occurred | |
else { | |
ppJson(response.data); // successful response | |
// More data. Keep calling scan. | |
if ('LastEvaluatedKey' in response.data) { | |
response.request.params.ExclusiveStartKey = response.data.LastEvaluatedKey; | |
dynamodb.scan(response.request.params) | |
.on('complete', doScan) | |
.send(); | |
} | |
} | |
} | |
console.log("Starting a Scan of the table"); | |
dynamodb.scan(params) | |
.on('complete', doScan) | |
.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment