get a document from firestore code example
Example 1: how to query in firestore
db.collection("cities").where("capital", "==", true)
.get()
.then(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
console.log(doc.id, " => ", doc.data());
});
})
.catch(function(error) {
console.log("Error getting documents: ", error);
});
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()))