This is mainly a design choice, but my vote was to choose a scheme that weakly reflects the database that stores collections.
If you are likely to store data in an SQL database, you will most likely have separate tables for songs
and genres
. You could connect them either through the genre_id
column in the song table, or (if songs can have more than one genre) in terms of a separate song_genres
join song_genres
. Consequently, you will probably need separate collections representing genres and songs within them. In this case, backbone-relational can be a very useful tool to help keep them straight.
If you store information in any relational / key value / document repository, it makes sense to just save the genre directly in the song and filter it accordingly. In this case, you can save your keys / requests to the document so that you can directly access the songs (for example, through songs
) or through the genre (for example, genre:genre_id/songs
). If this is your route, it may be more convenient to simply create one huge collection of songs and plan to configure the appropriate filters both in the application environment and in the database.
source share