- 최신
- 최다 투표
- 가장 많은 댓글
Hi Patton,
To filter items in DynamoDB based on values within a nested list (like the History attribute in your example), you should use instead of contains in the FilterExpression a combination of projection expressions and filtering on the client side. Here's a high-level approach to achieve your goal:
-
Perform a scan or query operation to retrieve all the items from your DynamoDB table.
-
Use a projection expression to only retrieve the History attribute, as you are interested in filtering within this attribute.
-
In your application code, filter the retrieved items based on the condition you mentioned: data.request.addl_vars.key1 = 'value1'.
Keep in mind that using client-side filtering can be less efficient than performing filtering on the server side using expressions, but in cases where complex nested structures are involved, it may be the most practical approach.
Hope this documentation also helps: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Attributes.html#Expressions.Attributes.NestedAttributes
Here you should find more examples on nested attributes: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ExpressionAttributeNames.html#Expressions.ExpressionAttributeNames.NestedAttributes