title: key value store database on iOS
body: <p>One example of an effort to create a key value store database on the iOS is <a href="https://github.com/yaptv/YapDatabase" rel="nofollow">YapDatabase</a>.</p>
  
  <p>However, I have no experience with it, and would like to understand whether it's worth it to use this, instead of something like Core Data or FMDB.</p>
  
  <p>One critical question I have is: How do I manage object relationships with this database?</p>
  
  <p>If I can avoid object relationships, I'm looking for suggestion or database design tips on how to solve the problem of an object that has many-to-many relationship to another object. </p>
  
  <p>Let's consider one use case (this is just an example, to help solving this problem):</p>
  
  <p><code>sender &lt;&lt;-&gt;&gt; message &lt;&lt;-&gt;&gt; recipient</code></p>
  
  <pre><code>sender has a: 
      photo_data, 
      name, 
      gender, 
      age, 
      email, 
      username, 
      twitter_id, 
      facebook_id, 
      sender_id
  
  recipient has a: 
      photo_data, 
      name, 
      gender, 
      age, 
      email, 
      username, 
      twitter_id, 
      facebook_id, 
      recipient_id
  
  message has a:
      text, 
      rich_text, 
      picture_data, 
      voice_data, 
      shared_url, 
      message_id
  </code></pre>
  
  <p>I have thought about using the message_id, sender_id, and recipient_id to relate each model, but is there a better way?</p>