1 個回答
- 最新
- 最多得票
- 最多評論
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
})
相關內容
- AWS 官方已更新 9 個月前
- AWS 官方已更新 2 年前