4

When adding an array at DynamoDB with put_item, is there any way to tell it to preserve the order of the values of the array?

Example: I'm adding array("2", "1", "4"), and it's added to the table as 1, 2, 4. I don't want dynamo to mess up with my array :)

Thanks in advance.

2 Answers 2

2

No, as arrays in dynamoDB are Sets, they don't preserve any ordering.

best alternative for you is to concatenate them into a string (using a delimiter) and then inserting this string i.e. 2#1#4 and then split them when you read back.

2

No. Although you use PHP arrays when inserting values, DynamoDB doesn't actually support arrays. Instead it offers sets, which don't have any ordering and don't allow duplicate values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.