I have a order data that has user data and hotel data as references. Now i have the below code to get 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']
}
});
});
But uid and vid returns firestore document since it is a reference. But i tried like this
uid:e.payload.doc.data()['uid'].get().then(data=>{return res.data()}));
But it is returning a ZoneAwarePromise. How to get the value of the document?
OrderService.ts
getOrders() {
return this.db.collection('orders').snapshotChanges();
}