I'm relatively new to Firebase, as well as the new Query API that comes along with it.
Basically, I've got a data store setup where users can add videos from YouTube that they showcase on their profiles. Since users can have many videos and videos can have many users, I've attempted to construct my data store in the appropriate fashion, based on best practices, as shown here:
{
users {
c25zdGFyb3NjaWFrQGdtYWlsLmNvbQ==
videos {
AFA-rOls8YA: true,
AlLsp4gnyDQ: true,
dX_1B0w7Hzc: true,
ik5qR5bw75E: true,
njos57IJf-0: true
},
videos {
AFA-rOls8YA {
attached_members {
c25zdGFyb3NjaWFrQGdtYWlsLmNvbQ==: true
}
title: "Hello...it's me"
},
AlLsp4gnyDQ: { ... },
dX_1B0w7Hzc: { ... },
ik5qR5bw75E: { ... },
njos57IJf-0: { ... },
zn7-fVtT16k
}
}
}
}
What can I do to query these objects in such a way where I can get back a single user that looks like this:
c25zdGFyb3NjaWFrQGdtYWlsLmNvbQ: {
videos: {
AFA-rOls8YA: {
attached_members: { ... }
title: "Hello...it's me"
},
AlLsp4gnyDQ: { ... },
dX_1B0w7Hzc: { ... },
ik5qR5bw75E: { ... },
njos57IJf-0: { ... },
zn7-fVtT16k: { ... }
}
}
I have many instances where something like this is going to need to happen. I'm currently using Ionic 2, AngularFire 2, but can use the native Javascript SDK if needed. I see many posts about structuring the data in this way, but I don't see that posts as straight forward as answering how to get it in the most optimized modern way, with Firebase 3.
Any thoughts on how to do this?