1 Answer
- Newest
- Most votes
- Most comments
1
You don't need to loop the PutItem. You also only need the first item in data
list:
switch (event.routeKey) {
case "PUT /sheets/{userID}/{MMYY}":
const MMYY = parseInt(event.pathParameters.MMYY);
// Assuming the request body is in the form { "data": [...] }
const data = event.body ? JSON.parse(event.body).data : [];
// Create an array of PutCommand operations
new PutCommand({
TableName: tableName,
Item: {
userID: event.pathParameters.userID,
MMYY: MMYY,
data: data
},
})
// Execute all PutCommand operations
await dynamo.send(command);
Relevant content
- Accepted Answerasked 9 months ago
- asked 4 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago
I want all the items in the list.
Edited the code to store the whole list