1 Answer
- Newest
- Most votes
- Most comments
3
The short answer is its not possible to do what you are trying, you must return the entire map.
Second, your read request unit will charge you for the entire read of the item, regardless which fields are returned.
Depending on your application needs, you may benefit from remodeling your schema:
PK | SK | Other |
---|---|---|
apple | OWNER#Adam | Data |
apple | OWNER#Eve | Data |
apple | OWNER#Samuel | Data |
apple | OWNER#Lee | Data |
orange | OWNER#Dave | Data |
orange | OWNER#Matthew | Data |
orange | OWNER#Sarah | Data |
orange | OWNER#Ben | Data |
Now you can simply Query
with PK=apple
& Limit=5
dynamodb.query({
"TableName": 'Fruits',
"KeyConditionExpression": `#pk = :val`,
"ExpressionAttributeNames": {
"#pk": "PK"
},
"ExpressionAttributeValues": {
":val": { "S": "apple" }
},
"Limit": 5
})
Relevant content
- asked 7 months ago
- asked a month ago
- asked 4 days ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago