how can we get document and collection at a time in firestore code example
Example 1: firestore get all documents in collection
db.collection('documents')
.get()
.then(querySnapshot => {
const documents = querySnapshot.docs.map(doc => doc.data())
})
db.collection('documents')
.doc(documentId)
.get()
.then(snapshot => {
const document = snapshot.data()
})
Example 2: collection get firesotre
async getMarker() {
const snapshot = await firebase.firestore().collection('events').get()
return snapshot.docs.map(doc => doc.data());
}