title: How to perform join for each of the value in array in rethinkdb
body: <p>I am working on a web platform that serves media content. I am adding 'follow' feature similar to twitter in the platform. Each user must get update from someone they follow in my platform.</p>
  
  <p>I am confused on how to design the database for the 'follow' feature. This is what i tried.</p>
  
  <p>User table containing the info about user also has a follow array.</p>
  
  <pre><code>{ 
    id: 'f344cf91-c14f-4772-b481-a5fea8f3107a',
    name: 'something',
    email:'abc@gmail.com",
    username:'adadas',
    password:'234231wwe1'
    follow :  []
  }
  </code></pre>
  
  <p>The follow array is used to keep track of the other's <strong>user-ID</strong> whom the current user follows. 
  I want to get the posts by the users in the follow array.</p>
  
  <p>Posts are stored in another <strong>post</strong> table.</p>
  
  <p>I want to join user-Id in follow array and the post table to retrieve posts from each user.
  I think <strong>for_each</strong> command is to be used to iterate over the array elements. But i am not sure how to join each element of array with table <strong>post</strong>
  Can someone please help me in this. Also i am not sure this is the efficient way to implement this kind of a feature in rethinkdb since it requires many joins.</p>