title: Manage documents available in hierarchical folder structure in AWS DynamoDB
body: <p>I am new to DynamoDB (document DB) and need help in designing table structure in 
  nosql database.</p>
  
  <p>I need to manage documents which are available in different folders. folder hierarchy can go to nth level and same document can be available in multiple folders.</p>
  
  <p>In case of relational database I can maintain the hierarchy and documents in different tables and extract the required information by applying joins on these tables.</p>
  
  <p>I need to know best way to store this data in DynamoDB tables, so that information can be extracted in most efficient manner. Each user will have certain permission based on which he/ she can view or edit document.</p>
  
  <p>Currently I am trying to store it in following structure:</p>
  
  <pre><code>documents = [
  {
      _id: ...,
      title: "...",
      date_uploaded: ...,
      folders: [
          folderId,
          ...
      ]
  },
  ...
  ]
  
  folders = [
  {
      _id: ...,
      title: "..."
  }
  ]
  </code></pre>
  
  <p>Here with the help of documentId, I can extract the list of folders in which the document exists and details of that folder from folders table, but an not sure how to maintain the folder hierarchy.</p>
  
  <p>Can someone help me with this scenario?</p>