I am working with a collection called A, which contains documents that reference other documents in collection B.
https://i.sstatic.net/C1HtT.png
When fetching my A documents from the service, I receive an array of objects that are not usable. However, I want to be able to view them as well.
getAs() {
this.aService.getAs().subscribe((data) => {
this.aArray = data.map((e) => {
return {
id: e.payload.doc.id,
...(e.payload.doc.data() as {}),
} as A;
});
//TODO some magic to get a nice array of B's inside every A
});
}
https://i.sstatic.net/O6suh.png
It is crucial for me to retrieve an array of A objects with arrays of B objects inside, rather than having two separate arrays for A and B.
I hope I have communicated my needs clearly. Thanks in advance