如何查询greates值(sortkey / range)dynamodb? [英] How to query the greates value (sortkey/range) dynamodb?

查看:187
本文介绍了如何查询greates值(sortkey / range)dynamodb?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许这是一个非常简单的问题,但是我没有找到合适的解决方案。我有一个辅助键/ range键/ sort键,它的值
是一个数字。因此,在表中有几个具有此键的项目,我想让
的项目具有最大的数字/值。我在堆栈溢出时发现了 this 看起来不像来自aws的
文档。在本文档中,您可以找到gt或ge,但我不想将
的值与数字进行比较,我想要最大的值...也许您可以提供帮助

Maybe this is a very simple question but I didn't find a suitable solution for this. I have a secondary key /range key /sort key, what ever and its value is a number. So in the Table a several items with this key and I want to get the Item with the greatest number/value. I found this at stack overflow but this does not look like something from the aws documentation. In this documentation you can find gt or ge but I don't want to compare the value with a number, I want the greatest ... Maybe you can help

推荐答案

如果要查询的属性是排序/范围键,则只需设置 ScanIndexForward = false (顺序降序)并将 Limit 设置为1

If the property you want to query is your sort/range key, you only need to set ScanIndexForward=false (order descending) and set the Limit to 1

这篇关于如何查询greates值(sortkey / range)dynamodb?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆