afr
afr

Reputation: 19

Firebase collection

I have this database in firebase: 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: consolelog

Do any of you knows what's happening and how to fix it?

Upvotes: 0

Views: 113

Answers (1)

Shaurya Vardhan Singh
Shaurya Vardhan Singh

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

Related Questions