I can't delete this field from firestore:
any suggestions?
I have firebaseConfig, it's just big so i didn't paste it here.
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
I tried to use code below but vsStudio's showing 'Signature declarations can only be used in TypeScript files'
updateDoc(doc(db, "userChats", currentUser.uid),{
deleteField(fieldId)
})
The syntax to delete a field is:
updateDoc(referenceToDocument,{
"fieldName": deleteField()
})
If you want to use a variable as the field name, that'd be:
updateDoc(referenceToDocument,{
[fieldNameVariable]: deleteField()
})