how to get collection from document firestore code example
Example 1: collection get firesotre
async getMarker() {
const snapshot = await firebase.firestore().collection('events').get()
return snapshot.docs.map(doc => doc.data());
}
Example 2: get one document based on id in firestore
const [userDetails, setUserDetails] = useState('')
db.collection('users').doc(id).get()
.then(snapshot => setUserDetails(snapshot.data()))
Example 3: firebase get doc collection
db.collection("restaurants").doc("123").collection("reviews").get().then(querySnapshot => {
querySnapshot.forEach(doc => {
console.log(doc.id, " => ", doc.data());
});
});