I'm trying to set an object on Firebase database realtime by looping a list. For example, I have list of Objects. I want to run over that list and each loop save on database realtime the object. This is the code:
if(feedVideosList.length > 0){
feedVideosList.forEach(video =>{
return admin.database().ref('/userFeed/${userUID}/').set(video);
}).catch(error =>{
console.log("Error user feed: ",error);
});
}else{
console.log("Problem with the videos list: ",error);
}
I'm pretty sure that this code is wrong and thats not the way I should write it. Like i said, what I'm trying to do is to run over a list and save each time the data on spasific node. The question is how should i do that, whats the right way to do that?