I have a ionic v4 app. When user navigate to profile page clicking on link (routerLink="/profile") I do a query to firestore, and everything is fine, the query is:
let ref = this.asf.collection('posts', ref => ref
.where('creatorId', '==', creatorId)
.where("type","==","N")
.orderBy("createAt", "desc")
.limit(count)
).snapshotChanges();
console.log("-----------------");
console.log(ref);
console.log(ref.map);
console.log("-----------------");
ref.map(actions => {
return actions.map(a => {
const data = a.payload.doc.data();
const id = a.payload.doc.id;
return { id, ...data };
});
});
But, when the user enters by typing the url in the browser, ref.map is undefined.
Why when the user enters by typing the url in the browser ref.map return undefined? Any idea or suggestion?
After upgrading to ^5.0.0-rc.9 it finally works like this: when we use rxjs map, we should use pipe operator.
Try ref.pipe(map(action =>{......}))