Id like to get a snapshot with snapshot.key as the UID if the snapshot.value is "pending". Store that into an array. Then i'd like to loop through the array of UID and pull of all the details from .child("users") i.e. "email", "name" & "profileURL". Not sure what the best route is here. Do I store the snapshot into a dictionary then filter dictionary to "pending" or do this within the snapshot call itself?
friends & users JSON structure in my Firebase Database (as below;)
{
"friends" : {
"YPQYLtXnMbbmFugrJJPYe6rOIJg2" : {
"Z6PnyFKSR9MBMd9dfCEs0VMIOog2" : "pending"
},
"Z6PnyFKSR9MBMd9dfCEs0VMIOog2" : {
"YPQYLtXnMbbmFugrJJPYe6rOIJg2" : "pending",
"ZyAV7PH4VHWnLyWrWaZty5C9RWT2" : "pending",
"lNI9FxCErqMUNiW43yiDpkNoljg1" : "pending"
},
"ZyAV7PH4VHWnLyWrWaZty5C9RWT2" : {
"Z6PnyFKSR9MBMd9dfCEs0VMIOog2" : "pending"
},
"lNI9FxCErqMUNiW43yiDpkNoljg1" : {
"Z6PnyFKSR9MBMd9dfCEs0VMIOog2" : "pending"
}
},
"users" : {
"YPQYLtXnMbbmFugrJJPYe6rOIJg2" : {
"email" : "[email protected]",
"name" : "Karen Alaedidibgghi Liangescu",
"profileURL" : "someURL"
},
"Z6PnyFKSR9MBMd9dfCEs0VMIOog2" : {
"email" : "[email protected]",
"name" : "Patricia Alaefhcbebjid Warmansen",
"profileURL" : “someURL”
},
"ZyAV7PH4VHWnLyWrWaZty5C9RWT2" : {
"email" : "[email protected]",
"name" : "Harry Alaeejdjagjga Greenestein",
"profileURL" : "someURL"
},
"lNI9FxCErqMUNiW43yiDpkNoljg1" : {
"email" : "[email protected]",
"name" : "Maria Alaefehgadbdg Valtchanovsky",
"profileURL" : "someURL"
}
}
}
Any help greatly appreciated. Cheers!