I am currently working with order data that includes user data and hotel data as references. As shown below, I have the following code to retrieve the data:
this.orderService.getOrders().subscribe(result => {
this.orders = result.map(e => {
return {
id: e.payload.doc.id,
uid: e.payload.doc.data()['uid'],
vid: e.payload.doc.data()['vid'],
grandTotal: e.payload.doc.data()['grandTotal'],
status: e.payload.doc.data()['status'],
paid:e.payload.doc.data()['paid'],
time:e.payload.doc.data()['time']
}
});
});
However, when trying to access uid and vid, which are references to Firestore documents, I attempted the following code snippet:
uid:e.payload.doc.data()['uid'].get().then(data=>{return res.data()}));
Unfortunately, this is returning a ZoneAwarePromise. Can someone please advise on how to retrieve the value of the document?
Here is a snippet from OrderService.ts:
getOrders() {
return this.db.collection('orders').snapshotChanges();
}