First look at the data structure I have created in Firestore:
albums (collection)
- album_id1 = (doc)
year: 1994
title: "1942: A Love Story"
uploaded_at: February 23, 1997 at 7:15:52 AM UTC+5:30
thumbnail: "https:localhost:3000/album-image/1942alovestory"
- album_id2 = (doc)
year: 2014
title: "2 States"
uploaded_at: July 23, 2018 at 7:15:52 AM UTC+5:30
thumbnail: "https:localhost:3000/album-image/2states"
...
artists (collection)
- artist_id1 = (doc)
name: "2 Chainz"
thumbnail: "https:localhost:3000/artist-image/2chainz"
- artist_id2 = (doc)
name: "Arijit Singh"
thumbnail: "https:localhost:3000/artist-image/arijitsingh"
...
genres (collection)
- genre_id1 = (doc)
name: "English"
- genre_id2 = (doc)
name: "Hindi"
songs (collection)
- song_id1 = (doc)
album: (ref) /albums/album_id1
artists: [
(ref) /artists/artist_id1,
(ref) /artists/artist_id2
]
genre: /genres/gerne_id1
title: "Ek ladki ko dekha"
...
Now in this type of data structure, I want to do two things
- How to read a song with album, artists, and genre data as well in just a single call to Firebase API.
- Second I want to read 25 songs with album, artists, and genre data, how can I do that?
Please let me know if this is possible with minimum API calls and also let me know if this structure needs to be revised