gpt4 book ai didi

amazon-dynamodb - DynamoDB降序读取记录

转载 作者:行者123 更新时间:2023-12-04 05:06:24 25 4
gpt4 key购买 nike

我收集了100条记录,

集合名称:“用户”

{
"name":'senthilkumar',
"email":'senthily88@gmail.com', //HashKey
"age":21,
"created":1465733486137, //RangeKey-timestamp
}

我需要获取以下SQL查询明智的记录
select * from users order by created desc limit 10

我如何从 DynamoDB 中获取上述查询格式记录

最佳答案

Dynamodb按范围键属性对结果进行排序。您可以将ScanIndexForward bool(boolean) 参数设置为true升序或false降序。

资源:http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html

Use the KeyConditionExpression parameter to provide a specific value for the partition key. The Query operation will return all of the items from the table or index with that partition key value. You can optionally narrow the scope of the Query operation by specifying a sort key value and a comparison operator in KeyConditionExpression. You can use the ScanIndexForward parameter to get results in forward or reverse order, by sort key.

关于amazon-dynamodb - DynamoDB降序读取记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37774154/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com