DynamoDB ordered list

amazon-dynamodb

Solution

I don't believe it is possible to store an ordered list as an attribute, as DynamoDB only supports single-valued and (unordered) set attributes. However, the performance overhead of storing a string of comma-separated values (or some other separator scheme) is probably pretty minimal given the fact that all the attributes for row must together be under 64KB.

(source: http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/DataModel.html)

Problem

I'm trying to store a List as a DynamoDB attribute but I need to be able to retrieve the list order. At the moment the only solution I have come up with is to create a custom hash map by appending a key to the value and converting the complete value to a String and then store that as a list. eg. key = position1, value = value1, String to be stored in the DB = "position1#value1" To use the list I then need to filter out, organise, substring and reconvert to the original type. It seems like a long way round but at the moment its the only solution I can come up with. Does anybody have any better solutions or ideas?

Original source