Reputation: 2363
I'm using DynamoDB / Amazon Web Services with their SDK Object Persistence Model. I have an object type that has some basic parameters and some lists that are stored. This works fine and the lists are stored as string sets on the DB. To save the objects back to the DB I'm simply calling:
context.Save<AwsProject>(project);
This is working fine as long as the list isn't empty. If I have had items in the list and then remove the last one, creating an empty list, this does not save, the last item stays in there...
What am I missing? Is there something else I need to do to clear out that last value?
Upvotes: 0
Views: 1035
Reputation: 2363
Ok I just got back to this and I think I must have been doing something else in my code that was not letting it remove properly. I worked on a few other things and fixed some issues in the saving and when I came back to address this it's gone. Removing the last item from my collection and then using the context to save the object now removes the attribute without me expressly doing it. Sorry for the confusion but it looks like their API does indeed handle this as I would expect...
Upvotes: 1
Reputation: 2863
DynamoDB doesn't support empty sets. See the very last sentence of the DynamoDB Naming Rules and Data Types article. If your list is empty, you should completely delete the attribute that is storing the list.
Upvotes: 2