1

I have a DynamoDB table Contact, where userId is a hashKey and id is a range key. Now, there are also parameters like categoryId and deleted ( true|false ).

I need to update all user's contacts within the certain category ( categoryId should be specified ). I've created local secondary index ( userId as hashKey and categoryId as rangeKey ), but still have no luck.

NB! I need to update all items in one query. The number of items is really big, so selecting all of them and updating individually is not an option.

Any help would be highly appreciated! Thank you in advance.

user3489820
  • 1,459
  • 3
  • 22
  • 38

1 Answers1

2

There is no way to update results in DynamoDB if you don't posses keys to the objects beforehand. This means that while you can do that in SQL (UPDATE + WHERE) you can't do that in DynamoDB. You will have to first fetch the objects (using the secondary indices) and then do a batch update on the primary keys.

Chen Harel
  • 9,684
  • 5
  • 44
  • 58