Horje Website
Dynamodb Get All Items Nodejs Javascript Code
 
 
  1. export const scanTable = async (tableName) => {
  2. const params = {
  3. TableName: tableName,
  4. };
  5. let scanResults = [];
  6. let items;
  7. do{
  8. items = await documentClient.scan(params).promise();
  9. items.Items.forEach((item) => scanResults.push(item));
  10. params.ExclusiveStartKey = items.LastEvaluatedKey;
  11. }while(typeof items.LastEvaluatedKey != "undefined");
  12. return scanResults;
  13. };
Published:
November 1, 2022
Author:
admin
Category:
Live Code
Views:
6

This article was posted in Live Code and tagged . Bookmark the permalink. Follow comments with the RSS feed for this post.Post a Comment or leave a trackback: Trackback URL.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Horje © 2011 - 2023