I have the following sort key in a dynamo db table:
YYYY-MM-DD##
Im trying to solve the following two access patterns:
1. get all item for a user in the last x days
2. get all items for a user and category in the last x days
I can satisfy the 2nd access pattern with the following conditional expression:
sort_key BETWEEN 2018-01-02## and 2019-01-02##
This returns several items between 2018-01-02 and 2019-01-02
However, if I try to satisfy the 1st access pattern I cant get it to work. I've tried:
sort_key BETWEEN 2018-01-02# and 2019-01-02#
But only one item is returned, the item with date 2018-01-02, but I should be getting multiple items returned.
I searched online for any wildcard operators with conditional expression, but couldn't find any. Any ideas how I can satisfy access pattern 1?
Asked by GWed
(519 rep)
Sep 10, 2019, 06:37 AM