- Mais recentes
- Mais votos
- Mais comentários
You must use Scan
with a FilterExpression
to achieve your use case.
You can set the Limit
to 500, but keep in mind that the Filter is applied after the limit is reached, so you are only guaranteed ~500 items, not exactly 500.
A single Scan operation reads up to the maximum number of items set (if using the Limit parameter) or a maximum of 1 MB of data and then apply any filtering to the results using FilterExpression. If LastEvaluatedKey is present in the response, you need to paginate the result set. For more information, see Paginating the Results in the Amazon DynamoDB Developer Guide.
this will filter the data , I need the data to be ordred by one of the columns In this case , I need the data to be sorted by 'status' attribute ,, status attribute can have values (PASS,FAILED,EVALUATING,DEGRADING,<>)
If you need all your data ordered by status
, then you would have to create a GSI with a static partition key and status
as sort key.
GSI_PK | GSI_SK | Data |
---|---|---|
1 | DEGRADING | Data |
1 | PASS | Data |
1 | PASS | Data |
This would ensure you can get the data returned sorted by the sort key as DynamoDB does not provide sorting across partition keys. Keep in mind this solution would limit your writes to 1000 WCU per second. If you require more you can shard the partition key.
this will filter the data , I need the data to be ordred by one of the columns In this case , I need the data to be sorted by 'status' attribute ,, status attribute can have values (PASS,FAILED,EVALUATING,DEGRADING,<>)
Updated my answer.
Thank you , it there a possibility to sort by multiple attibutes