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.