1

I have a list of items. Each item has a version number.

UUID | Version
--------------
ABC  | 1
DEF  | 1
ABC  | 2
ABC  | 3
XYZ  | 1

How can I obtain a list that would return

ABC 3
DEF 1
XYZ 1

I know when I use .query for one item, getting max version is available by doing ScanIndexForward: false since the version is a sort key in this case. Not sure of the scan way of doing this, if there is any.

1 Answer 1

0

I do not think this is possible. You could do it in code once you retrieved all the results or you could reach for Elastic Map Reduce (which I understand is a bit heavy handed for a task like this).

Alternatively, you could try to manage which record was the "current" version and add that to your scan or hold separate in another table.

Probably some other options, but I'm sure all are less than ideal, sorry.

1
  • Marking you as the answer since you were right that it's not possible. I added a current_version flag. When I go to update the record with a new version, I just take the last item with the same UUID and update its version flag to false.
    – Dave Stein
    Jul 19, 2016 at 15:43

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.