Complete the code to specify the partition key attribute name for the main table.
TableName: 'Orders', KeySchema: [{ AttributeName: '[1]', KeyType: 'HASH' }]
The partition key uniquely identifies each order, so 'OrderId' is used as the HASH key.
Complete the code to add a sort key attribute for storing multiple items per order.
KeySchema: [{ AttributeName: 'OrderId', KeyType: 'HASH' }, { AttributeName: '[1]', KeyType: 'RANGE' }]The sort key 'ItemId' allows multiple items to be stored under the same order partition key.
Fix the error in the query to fetch all items for a specific order using the partition key.
const params = { TableName: 'Orders', KeyConditionExpression: 'OrderId = [1]', ExpressionAttributeValues: { ':orderId': '12345' } };In KeyConditionExpression, attribute values must be placeholders starting with ':', so ':orderId' is correct.
Fill both blanks to create a query that fetches items for an order with a specific item ID.
KeyConditionExpression: 'OrderId = [1] AND ItemId = [2]', ExpressionAttributeValues: { ':orderId': '12345', ':itemId': 'A1' }
Both 'OrderId' and 'ItemId' must be compared to their respective placeholders ':orderId' and ':itemId' in the expression.
Fill all three blanks to define a DynamoDB item with a partition key, sort key, and an attribute for quantity.
Item: { 'OrderId': [1], 'ItemId': [2], 'Quantity': [3] }The item must have 'OrderId' and 'ItemId' as strings, and 'Quantity' as a number.