如何查询介于开始日期和结束日期之间的条目-DynamoDB [英] How to query for an entry that falls between start and end date - DynamoDB

查看:90
本文介绍了如何查询介于开始日期和结束日期之间的条目-DynamoDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是DynamoDB的新手,并且有一个疑问,我如何才能找到DynamoDb表中的所有实时条目。我表中的每个条目都有开始和结束日期。我对如何查询当前日期介于开始日期和结束日期之间的条目感到困惑。有什么想法可以做到吗?

I am new to DynamoDB, and had a question how I can find all of the live entries in my DynamoDb table. Each entry in my table has a start and end date. I am confused on how I can query for the entries that the current date falls between the start and end date. Any ideas how I can do this?

我知道我只能拥有主键和范围键。

I understand that I can only have a primary and range key. Is it possible to query for other columns in the entry?

每个条目看起来像这样:

Each entry looks like this:

id: xxxxxx
startDate:123456 //时代
endDate:334243 //时代

id: xxxxxx startDate: 123456 // Epoch time endDate: 334243 // Epoch time

推荐答案

如果不知道您项目的哈希键(在您的情况下看起来像'id'),那么查询DynamoDB的唯一方法是使用全表扫描。

If you do not know the hashkey of your item(looks like 'id' in your case) then the only way to query DynamoDB is using a full table scan.

您可以使用多种条件进行表扫描,但这效率低下。

You can do a table scan using multiple conditions, but this is inefficient.

这篇关于如何查询介于开始日期和结束日期之间的条目-DynamoDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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