I would like to know if it is possible with Firebase.util.NormalizedCollection to merge 3 paths or more who depends on each other. On firebase doc it said that the best practice with our datas is to have flattened data as possible, so I have that :
question :
uniqueIdqestion1 :
myquestion : "ma question",
answers : {
uniqueIdanswer1 : true,
uniqueIdanswer54 : true
}
answer :
uniqueIdanswer1 :
my_answer : "my answer",
people : {
uniqueIdpeople1 : true
}
people
uniqueIdpeople1 :
name : "pedra"
With Firebase.util.NormalizedCollection, I would like to list all the answer for my question and have an array like that :
key_answer : uniqueIdanswer,
my_answer : "ma response",
name : "pedra"
I tried to have something like that with this code :
var ref = firebase.database().ref();
var nc = new firebase.util.NormalizedCollection(
ref.child('questions/' + $state.params.chatId + '/answers'),
[ref.child('answers'), 'widget2'], // B path
... ??? // C path
)
.select('widget2.my_answer', ???).ref();
$scope.reponses = $firebaseArray(nc);
But I can't still understand how to merge the B and C path. Maybe it's because C doesn't refer directly to the main path, I don't understand because something is missing for me in my mind ... Please can you help me with that ?