title: AWS DynamoDB - How to achieve in 1 call: Add value to set, if set exists - or else instantiate set with value?
body: <p>I have a users table, there is an attribute called friends, which will be a set of the id's of all the user's friends.</p>
  <p>Initially I tried instantiating the friends attribute to an empty set when the user is created, but I get an error that you can't have an empty attribute.</p>
  <p>So the only solution I could find if someone has no friends yet is to read the attribute on the user, if it does not exist, SET the attribute to a [new] set with the friend they are adding. If it does exist, then just perform an update with an ADD, which adds the new friend to the set.</p>
  <p>I don't want to have to make two calls to AWS for this.</p>
  <p><em>Is there a way to create the set if it doesn't exist, and if it does, add to it - all in just 1 call?</em></p>