Encountering a challenge with Angular5 and Firestore
My Objective
Retrieve a Firestore Collection named
minutes
Assign the content of the collection to my component variable, also named
minutes
, as an Observable object containing the ID of eachminute
document.
Currently facing the following error
Property 'id' does not exist on type 'QueryDocumentSnapshot<any>'
This is my code for extracting the collection from Firestore
minutesArray: AngularFirestoreCollection<any>;
minutes: Observable<any[]>;
constructor(private afs: AngularFirestore) {
this.minutesArray = afs.collection<any>('minutes', ref => ref.orderBy('year', 'desc'));
this.minutes = this.minutesArray
.snapshotChanges()
.pipe(map(actions => actions.map(a => {
const data = a.payload.doc.data();
#### NEXT LINE ERRORS OUT ####
const id = a.payload.doc.id;
return { id, ...data };
}))
);
Seeking insights on why this error is occurring
No solutions were found in this Github Issue
`