I receive this error in the following code: Property 'id' does not exist on type 'QuerySnapshot'.
my code gives an error. I am trying to first query a list of users (that are in a collection) from Firestore than use the data to query from an other collection. It seems like I am making an error while updating the list which could be caused by a mistake in query part.
const dailyTaskFunction = functions.pubsub.schedule("0 0 * * *").timeZone("GMT +3").onRun(async () => {
const users = await db.collection("users").where("location", "==", "GMT+3").get();
const taskPromises = users.docs.map((doc) => {
return db
.collection("tasks")
.where("dailyTasks", "==", true)
.where("completed", "==", true)
.where("userID", "==", doc.get("userID"))
.get();
});
const taskDocs = await Promise.all(taskPromises);
const actionsPromises = taskDocs.map((snapshot) => {
return db.collection("tasks").doc(snapshot.id).set({ completed: false }, { merge: true });
});
await Promise.all(actionsPromises);
return null;
});