I'm currently working on a web form page that needs to update input fields into a specific firestore document based on certain conditions. Can anyone provide guidance on how this can be achieved?
The initial part where I retrieve the query results seems to be functioning correctly, as indicated by the correct query result displayed in the console log. However, the second part which involves updating the document appears to be encountering some issues.
const reportForm = document.querySelector('#daily-reports');
reportForm.addEventListener('submit', (e) => {
e.preventDefault();
const forward = reportForm['forward'].value;
const reflected = reportForm['reflected'].value;
// additional code for other input fields omitted for brevity
console.log(forward, reflected); // example fields logged here
firebase.initializeApp(config);
const db = firebase.firestore();
// authentication and query logic here
});
Upon executing the code, an error message is returned:
Error getting documents: TypeError: "doc.data(...).update is not a function"
<anonymous> func.js:42
forEach database.ts:2131
// Additional error logs truncated for readability