Complete the code to specify the table name in the BatchGetItem request.
{
"RequestItems": {
"[1]": {
"Keys": [
{ "UserId": { "S": "123" } },
{ "UserId": { "S": "456" } }
]
}
}
}The table name must be specified as the key in the RequestItems object. Here, "Users" is the correct table name.
Complete the code to specify the key attribute name for the BatchGetItem request.
{
"RequestItems": {
"Users": {
"Keys": [
{ "[1]": { "S": "123" } },
{ "UserId": { "S": "456" } }
]
}
}
}The key attribute name must match the primary key of the table. Here, "UserId" is the correct key for the Users table.
Fix the error in the BatchGetItem request by completing the missing attribute type.
{
"RequestItems": {
"Users": {
"Keys": [
{ "UserId": { "[1]": "123" } },
{ "UserId": { "S": "456" } }
]
}
}
}The attribute type for a string value in DynamoDB is "S". This must be used to specify string keys.
Fill both blanks to specify the ProjectionExpression and ConsistentRead options in BatchGetItem.
{
"RequestItems": {
"Users": {
"Keys": [
{ "UserId": { "S": "123" } }
],
"[1]": "UserName, Email",
"[2]": true
}
}
}ProjectionExpression specifies which attributes to return. ConsistentRead set to true ensures strongly consistent reads.
Fill all three blanks to complete the BatchGetItem request with multiple tables and keys.
{
"RequestItems": {
"Users": {
"Keys": [
{ "UserId": { "S": "123" } },
{ "UserId": { "S": "456" } }
]
},
"[1]": {
"Keys": [
{ "[2]": { "S": "789" } },
{ "OrderId": { "S": "101" } }
],
"[3]": false
}
}
}The second table is "Orders". Its key attribute is "OrderId". The ConsistentRead option is set to false for eventually consistent reads.