Can I create relationships between my object stores in IndexedDB?
For example, I have two object stores: artist
and album
. An artist
has a one-to-many relationship with an album
. album.artistId
relates the album to artist.id
.
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 artists
on the album
object.
artist.albums = [];
Follow Up (4.5 years later, 2017)
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.