I have the following JSON stored on my local which I want to store it on Firebase Firestore:
guides: [
{
"id":0
"name":"name0",
"sources":[
{
"type":"s3",
"url":"https://s3.amazonaws.com/xxxx/file0.mp3"
}
]
},
{
"id":1
"name":"name1",
"sources":[
{
"type":"s3",
"url":"https://s3.amazonaws.com/xxxx/file1.mp3"
}
]
}
]
What is the best solution for store "sources"? so when I make a search for "guides" (using firebase cloud functions), it retrieves the source list as well without making different searchs for each element of sources.
In Firebase Firestore, the array type doesn't allow a list of objects and I tried with "reference" but it returns the "structure and settings" of the document which is referencing.
function getGuides(guideId,response){
db.collection('guides')
.where('id', '==', guideId).get()
.then(snapshot => {
let guideDoc = snapshot.docs.map( doc => {
return doc.data()
})
return guideDoc;
})
guideare they severalsourcesor only one?