List all documents in a Firebase collection

July 29, 2018

You can list all of the documents in a Firebase collection like so:

firestore
  .collection('yourCollectionName')
  .onSnapshot(querySnapshot => {
    const results = []
    querySnapshot.forEach(document => {
      let item = document.data()
      results.push(item)
    })

    // Now, do whatever you want with your data:
    console.log(results)

  })