Skip to main content
added 3 characters in body
Source Link

I think the this would be a good solution if your intention is to know the record's id when querying the collection.

firebase.firestore().collection('sets').get()
    .then(querySnapshot => {
      querySnapshot.forEach(doc => {
        this.sets.push({ ...doc.data(), id: doc.id })
      })
    })
    .catch(error => {
      console.log(error)
    })

I think the this would be a good solution if your intention to know the record's id when querying the collection.

firebase.firestore().collection('sets').get()
    .then(querySnapshot => {
      querySnapshot.forEach(doc => {
        this.sets.push({ ...doc.data(), id: doc.id })
      })
    })
    .catch(error => {
      console.log(error)
    })

I think the this would be a good solution if your intention is to know the record's id when querying the collection.

firebase.firestore().collection('sets').get()
    .then(querySnapshot => {
      querySnapshot.forEach(doc => {
        this.sets.push({ ...doc.data(), id: doc.id })
      })
    })
    .catch(error => {
      console.log(error)
    })
Source Link

I think the this would be a good solution if your intention to know the record's id when querying the collection.

firebase.firestore().collection('sets').get()
    .then(querySnapshot => {
      querySnapshot.forEach(doc => {
        this.sets.push({ ...doc.data(), id: doc.id })
      })
    })
    .catch(error => {
      console.log(error)
    })