I'm using Angular with google cloud firestore to load data.
I also have a model class, let's call it IMyModel
export interface IMyModel{
data: any;
id: string;
}
of which the id is the id of the document on firestore. I can easily load this through
var docs = this.firestore.collection('myCollection').valueChanges({ idField: 'id' }) as Observable<IMyModel[]>; This neatly works.
But now, I also want this functionality with the document reference. Lets's say I alter the model
export interface IMyModel{
data: any;
documentReference: DocumentReference;
}
How can I now insert the documentReference field? I already tried
var docs = this.firestore.collection('myCollection').valueChanges({ ref: 'documentReference', }) as Observable<IMyModel[]>;
But this does not insert the field.