I have a list of place objects stored in Firebase Realtime Database like this:
And I'd like to filter and retrieve a snapshot of a group of places by their IDs as so: ["ChIJ16pHtWSfwokRhw2T-Kt5EIM", "ChIJ4UHbQuihwokRUj0afTh7s6g", ChIJAV0IY-ihwokRtf2PC4Cf9W0]
My current method involves looping and retrieving a snapshot of each individually. The reason it makes me uncomfortable is because this would require a nested snapshot reading. Which I am unsure is good practice or not. The first snapshot is to retrieve the list of ID's. Is there a more efficient way?
for (place in section) {
var place_data = target.child(place)
place_data.once('value').then(snapshot => {
console.log("FOUND SNAPSHOT")
console.log(snapshot.val())
if (snapshot.val()) {
dict[key].append(snapshot.val())
return snapshot.val()
} else { return null }
})
.catch((err) => {
console.log(err);
});
}