In DynamoDB the Hash Key
, or Hash Key
+ Range Key
combination must be unique.
On a Hash Key (id
) Only Table, id
must be unique.
id
--------
john
mary
jane
On a Hash Key (id
) + Range Key (timestamp
) Table, combination of id
+ timestamp
must be unique
id | timestamp
--------|-------------------------
john | 2014-04-28T07:53:29.000Z
john | 2014-04-28T08:53:29.000Z
john | 2014-04-28T09:53:29.000Z
mary | 2014-04-28T07:53:29.000Z
jane | 2014-04-28T07:53:29.000Z
If your table has a Hash Key
whose type is a String Set
, then DynamoDB expects the values of the String Set
to be unique as well.
id (String Set)
------------------------
["john"]
["mary"]
["jane"]
["john", "mary"]
["john", "jane"]
["john", "jane", "mary"]
Therefore, if you are trying to achieve the following below, if can be done because each combination is unique.
id (String Set)
----------------
["john", "mary"]
["john", "jane"]
But if you are trying to achieve the following below, then an exception will occur:
id (String Set)
----------------
["john", "mary"]
["john", "mary"]