'Firebase updateDoc function not working [Web v9 (modular)]
from what I understand I'm doing the exact replica of Firestore's sample but I get the error:
'Argument type {isDismissed: boolean} is not assignable to parameter type UpdateData<{isDismissed: boolean}> '
when I use updateDoc in example below, it doesn't update the database when run. I'm using web version 9.
const dismissPatientAlert = (alertId) => {
alert(alertId)
const docRef = doc(db, 'Alerts', alertId);
updateDoc(docRef, {isDismissed: true})
return 'dismissed alert';
};
my samples source: https://firebase.google.com/docs/firestore/manage-data/add-data#update-data Any insight will be appreciated, thanks
Solution 1:[1]
did you try to use setDoc instead ?
const dismissPatientAlert = (alertId) => {
alert(alertId)
const docRef = doc(db, 'Alerts', alertId);
setDoc(docRef, {isDismissed: true},{merge:true})
return 'dismissed alert';
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | deme-3 |
