Reputation: 19
I have this database in firebase:
Then, I have this code in javascript:
firebase
.firestore()
.collection('devices')
.doc(device.id)
.collection('pings')
.get()
.then(doc => {
doc.forEach(d => console.log(d))
})
The problem is: my console log is showing this, instead of showing each object in the ping collection:
Do any of you knows what's happening and how to fix it?
Upvotes: 0
Views: 113
Reputation: 684
use data method on doc fetched from firestore
firebase
.firestore()
.collection('devices')
.doc(device.id)
.collection('pings')
.get()
.then(doc => {
doc.docs.forEach(d => console.log(d.data())
})
Upvotes: 1