For anyone else having similar problem this answer might help you
So first of all there was a mistake inside my code but that gave me another answer
Mistake is is that i forgot to add async in forEach function
This should be like this
const result = await firestore.collection("organization-members").get();
result.docs.forEach(async (doc) => { // or result.forEach
const data = doc.data();
const organization = data.organization;
const orgData = await organization.get() // But this says that organization.get() is not a function
});
But this is not the correct way
Apparently async/await does not work properly inside forEach loop i don't know the reason behind this i did contact the firebase team and there representative said the same thing so the best way should be to use for loop
e.g
for(doc of result.docs)
This will always work fine
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…