I want to remove every value-field from the document "view-count" in the "server-details" collection in react with firebase. Currently I am deleting the document with deleteDoc() but I can't figure out how to create the document again. Here is my code:
const resetViewCounter = async () => {
const valueDoc = doc(database, "server-details", "view-count");
await deleteDoc(valueDoc);
await addDoc(valueDoc);
// window.location.reload(false); // temporarily
}
Thanks for your help!