I need get Firestore document in forEach loop. But I get error: 'await' expressions are only allowed within async functions and at the top levels of modules
How to get document in forEach loop?
querySnapshot.forEach(queryDocumentSnapshot => {
const doc = await admin
.firestore()
.collection('Collection')
.doc(queryDocumentSnapshot.id)
.get();
if (doc.id) {
// ...
}
}