Reputation: 27
This is My Demo Data From Firestore How Can Retrieve the bool value
Upvotes: 0
Views: 260
Reputation: 2808
Firestore is a Document Store Database. The operations available to you are to find/read, create, update and delete individual and ENTIRE documents (think: JSON objects) at a time.
There is no API to fetch/read just a single field within an existing document. Rather, you need to read the document (the JSON object), and then use whichever field(s) from that document that you wish.
So in your example you would do something like (pseudo-code below):
const getDocumentFromItsId = async (id) => {
try {
// fetch the document
let docRef = FIRESTORE.db.collection("User Information").doc(id);
let docSnap = await docRef.get();
let docData = docSnap.data();
return docData.applied; // will return boolean value or null
} catch (ex) {
console.error(`EXCEPTION while reading doc id(${id}):`, ex);
}
}
Upvotes: 1