title: DynamoDB one-to-many and many-to-many structure
body: <p>I am very new to DynamoDB and trying to understand relations.</p>
  
  <p>I have a todo app with users, lists and items.</p>
  
  <p>I have created 3 dynamoDB tables, one for users, one for lists and one for items.</p>
  
  <p>For simplicity, taking the user/list case.  The user's primary key is userId.  The list primary key is listId.  The user can have many lists.  Lists can be shared among users so lists can have many users.</p>
  
  <p>So should list's be saved in the user item as an array of listId's?  Then when I get a user, I iterate though the array of listId's and get all the lists?</p>
  
  <p>The user can have many lists which in turn can have many items so I don't want to save the entire list in the user item.  Also the list can be shared by many users.</p>
  
  <p>I have tried to search relations but they all seem so start off on the assumption that the reader has a broad idea of NOSQL databases which I don't.</p>