How can I display the orders data retrieved from Firebase in my browser console? See the image link below for reference.
https://i.sstatic.net/HPlaC.png
This is the code snippet for fetching data from Firebase and displaying it in the console:
orders(){
const db = firebase.firestore();
const dbOrderRef = db.collection('order');
dbOrderRef.get()
.then(res => {
res.forEach(doc => {
console.log(doc.data())
})
})
.catch(err => {
console.log('error', err)
})
}
I attempted to store the data in an instance variable like so:
ordersData = []
and then assign it in a method:
this.ordersData = doc.data()
However, this did not work as expected. Any suggestions on how to achieve this goal?
Thank you