Reputation: 59
Can we insert an item using the global secondary index or local secondary index in dynamoDB? Because I had a table in which two items having the same partition key and sort key when I used the mapper.save() function, it usually update the current item, I want it to be separate i.e., I want two items in the table. If I am able to insert the item using secondary index than my problem will be solved.
Upvotes: 1
Views: 1201
Reputation: 4845
No. GSIs and LSIs update from the base table only.
Can you do something with your partition key and make it a concatenated string and therefore unique? Like itemID::v1 and itemID::v2
Upvotes: 0
Reputation: 7132
No, you can only update the base table. And in the base table an item’s identity is defined by its primary key (combination of partition key and sort key). You cannot have two items with the same primary key.
Upvotes: 1