Encountered an issue while attempting to retrieve data from Firestore using Angular/Ionic.
PizzaProvider.ts
getAllPizzas() {
return this._afs.collection<Pizzas>('pizzas', ref => ref);
}
pizzas-list.ts
pizzas: Observable<any[]>;
// Implementation
this.pizzas = this._pizzaProvider.getAllPizzas().snapshotChanges().pipe(
map(arr => arr.map(doc => {
return { id: doc.payload.doc.id, ...doc.payload.doc.data() }
}))
);
However, upon execution, the following error was thrown:
ERROR TypeError: changes.forEach is not a function
at combineChanges (changes.js:19)
at ScanSubscriber.accumulator (changes.js:15)
at ScanSubscriber._tryNext (scan.js:111)
at ScanSubscriber._next (scan.js:104)
at ScanSubscriber.Subscriber.next (Subscriber.js:93)
at MapSubscriber._next (map.js:85)
at MapSubscriber.Subscriber.next (Subscriber.js:93)
at MapSubscriber._next (map.js:85)
at MapSubscriber.Subscriber.next (Subscriber.js:93)
at RefCountSubscriber.Subscriber._next (Subscriber.js:129)
Seeking assistance in identifying and resolving this issue. Any guidance would be greatly appreciated!