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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With