async function updateBookingSlots(appointmentID) {
let slotId;
await firestore
.collection("bookingSlots")
.where("appointmentID", "==", appointmentID)
.get()
.then((snapshot) => {
snapshot.forEach((doc) => {
slotId = doc.id;
});
});
await firestore.collection("bookingSlots").doc(slotId).update({
appointmentID: "",
patientID: "",
requester: "",
});
}
I'm trying to get the slotId of a booking slot by an appointmentID and then updating the slot. I'm making the calls to same collection twice, is there a way we can combine these two calls in a single call?