I have an angular 8 typescript interface set up that includes an array of another interface as an variable. Looks like the following:
export interface User {
name: string;
id: string;
history: Job[]; //this is what is not getting generated
}
and the Job interface looks like the following:
export interface JobJson {
id: string;
price: number,
notes: string
}
I am using Firebase's Cloud Firestore as my database and the database structure looks like this:
users // collection
|--> user1234 // document
|--> jobs //subcollection
|--> job1234 // sub document
When I query a user from firebase:
this.firestore.collection<UserJson>('users').doc<UserJson>(id).valueChanges().subscribe((u) => {
// do whatever with u
});
it, as expected, does not fill out the history: Jobs[]. But, in my program I need to set user.history array to the subcollection under user in firebase. How can this be acomplished? Thanks for any help!