I want the new ph value to be added in the arraylist but instead, it keep updating the first value of the arraylist
var insBtn = document.getElementById("InsBtn");
async function AddDocument_CustomID() {
var ref = doc(db,"pHvalue", "pH");
await setDoc(
ref, {
pH: [pH.value]
});
}
insBtn.addEventListener('click', AddDocument_CustomID);
If you want to add a new unique value to the existing values in the pH array, you can use an array-union operation:
updateDoc(ref, {
pH: arrayUnion(pH.value)
});
If you instead want to add a possibly non-unique value to the end of the pH array, you will instead have to:
pH array from it.