I've got a question about dealing with working with many-to-many relationships in Firebase. Basically, I'm trying to build a user profile object from multiple paths inside of my Firebase data. I've tried building a function that returns an observable and then updates the data in that observable as a nested observable grabs data from Firebase.
The problem is that the nested observable doesn't ever get called, from what I can tell. I've been beating my head against this for hours without any real success. Can anyone tell what I'm doing wrong? I feel this is a pretty common problem that gets solved.
public getUserProfile(data) {
return this._af.database.object(`/social/users/${data.id}`).map((user) => {
for ( let vidKey in user.videos) {
// Once the code hits this line, it never fires at all :(
this._af.database.object(`/social/videos/${vidKey}`).map((video) => {
user.videos[vidKey] = video;
});
}
return user;
});
}