I safed different products in my Firestore and they are available for purchase on different days of the week. So I safed the availability on different days as an Array of 7 boolean values in my Firestore.
weekdays = [true, true, true, false, false, true, false];
Now if I wanna get all products that are available on Friday I would have to do something like this:
// assume date.getDay() is 5
const q = query(
collection(db, "bakerys", `${bakery.id}`, "products"),
where(`weekdays[${date.getDay()}]`, "==", "true")
);
const querySnapshot = await getDocs(q);
This doesn't seem to work. Do I really have to store every weekday in its own value separately in order to make this work or is there a way to get this work differently.