I'm trying to make multiple sequential and dependent queries on a Firebase database. This is how the database look like :
books : { book1: { title: 'Book 1', author: 'author1' } }
authors: { author1: { name: 'Author 1' } }
I'd like to retrieve all the books, iterate through them, get the related author name, set the value in each book object and return an Observable array containing the book objects.
I tried this way :
getBooks(): Observable<Book[]> {
return this._af.database
.list('/books')
.flatMap(e => e)
.concatMap(e => this.getAuthor(e.author), (a, b) => {
a.author = b.lastName;
return a;
});
}
But this returns the first book only.
mergeMap()(aliasflatMap())