title: Redbean, Multiple many-to-many using same object
body: <p>Many-to-many mappings are easy to use in redbean with simple scenarios. But how do you do multiple many-to-many mapping between the very same object?</p>
  
  <p>Example:</p>
  
  <p>What I want to acomplish is in structure very similar to the twitter/instagram setup of "followers" and "following"</p>
  
  <pre><code>// this c
  
  $user = R::dispense('user');
  $user2 = R::dispense('user');
  
  // ..
  
  //Usr1 follows user2
  $user-&gt;sharedUser[] = $user2;
  
  // user2 follows user1
  $user2-&gt;sharedUser[] = $user1;
  </code></pre>
  
  <p>Now, I want to, from user1 perspective, list both the followers and the following users.</p>
  
  <p>However, I cannot list the "followers", without querying all users in the database and look for user1. Is there any way to have multiple "shared" lists in redbean or any nice workaround for these particular cases or is the query way the way to go?</p>