Complete the code to define a Global Secondary Index (GSI) with the partition key 'UserId'.
"GlobalSecondaryIndexes": [{"IndexName": "UserIndex", "KeySchema": [{"AttributeName": [1], "KeyType": "HASH"}], "Projection": {"ProjectionType": "ALL"}}]
The partition key for the GSI must be specified as 'UserId' to index by user.
Complete the code to add a sort key 'OrderDate' to the GSI.
"KeySchema": [{"AttributeName": "UserId", "KeyType": "HASH"}, {"AttributeName": [1], "KeyType": "RANGE"}]
The sort key for the GSI is 'OrderDate' to sort orders by date.
Fix the error in the attribute definitions by selecting the correct attribute type for 'OrderDate'.
"AttributeDefinitions": [{"AttributeName": "UserId", "AttributeType": "S"}, {"AttributeName": "OrderDate", "AttributeType": [1]]
'OrderDate' is stored as a string (S) in ISO 8601 format for sorting.
Fill both blanks to complete the GSI projection type and write capacity units.
"ProvisionedThroughput": {"ReadCapacityUnits": 5, "WriteCapacityUnits": [1], "Projection": {"ProjectionType": [2]
Write capacity units are set to 10 and projection type is 'ALL' to include all attributes.
Fill all three blanks to complete the GSI definition with index name, partition key, and projection type.
"GlobalSecondaryIndexes": [{"IndexName": [1], "KeySchema": [{"AttributeName": [2], "KeyType": "HASH"}], "Projection": {"ProjectionType": [3]]
The index is named 'UserDateIndex', partition key is 'UserId', and projection type is 'INCLUDE' to include specific attributes.