学会java能懂dynamo_如何使用Java设置DynamoDB返回的匹配项的限制?

在我的Android应用中,我想查询DynamoDB中的数据 . 将有一千个匹配的项目,但我只想获得它们中的前十个 . 我不知道如何设置这个限制 . 我在文档中找到了这些行:

DynamoDB查询和扫描API允许限制值限制结果的大小 .

在请求中,将Limit参数设置为您希望DynamoDB在返回结果之前处理的项目数 .

In a response, DynamoDB returns all the matching results within the scope of the Limit value. For example, if you issue a Query or a Scan request with a Limit value of 6 and without a filter expression, DynamoDB returns the first six items in the table that match the specified key conditions in the request (or just the first six items in the case of a Scan with no filter). If you also supply a FilterExpression value, DynamoDB will return the items in the first six that also match the filter requirements (the number of results returned will be less than or equal to 6).

但我找不到设定响应限制的方法 . 我找到了QueryResult的方法SetCount:

QueryResult result2 = dynamodb.query(request);

result2.setCount(5);

它说: then Count is the number of items returned after the filter was applied

但我认为这不是我想要的 . 因为DynamoDb在调用setCount之前仍会返回所有匹配项 . 谁能帮我?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值