title: IndexedDB and Relationships
body: <p>Can I create relationships between my object stores in IndexedDB?</p>
  
  <p>For example, I have two object stores: <code>artist</code> and <code>album</code>. An <code>artist</code> has a one-to-many relationship with an <code>album</code>. <code>album.artistId</code> relates the album to <code>artist.id</code>.</p>
  
  <p>I'm thinking along the lines of Hibernate here. I would like to do a query for artists and have the albums belonging to that artist returned as an array called <code>artists</code> on the <code>album</code> object.</p>
  
  <pre><code>artist.albums = [];
  </code></pre>
  
  <h3>Follow Up (4.5 years later, 2017)</h3>
  
  <p>There are some great answers below that answer the question very well. I'd like to add that I was originally trying to use IndexedDB as a relational store and build an ORM-like solution on top of it, which it is not suited for. IndexedDB is a NoSQL database and since I've started treating it that way it's made more sense and my projects easier to manage. I hope this adds some value to the original question for those who continually come across it.</p>