'How to query for a single field in firestore 9
I am trying to query the doc for data. I found out how to query using the flowing logic
const docRefCol = doc(db, 'UsersCollection', uid);
interface objectData {
field1Obj: { [key: string]: any };
field2Arr: [];
}
let obj: objectData = { field1Obj: {}, field2Arr: [] };
await getDoc(docRefCol).then((docSnap) => {
Object.assign(obj, docSnap.data());
});
console.log(obj)
The issue with this is I want an immutable way to extract data. Plus anther way to query for single field (let's say field1Obj), rather than calling the whole document.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
