I am trying to get a string from a firebase real-time database, add something to it and overwrite it back into the firebase DB.
When I try to do this I get the error :
TypeError: db._checkNotDeleted is not a function. (In 'db._checkNotDeleted('ref')', 'db._checkNotDeleted' is undefined)
Any idea how to get past this error?
For example, I want to get "lol=" string from the firebase DB and add "buzz=" to the string and override "lol=buzz=" in the same place in firebase.
And after I want to split the string by "=" to get each word.
I know that this could be done with arrays but I can't figure a way of writing the code for it.
import { getDatabase, ref, onValue, child, set, get } from "firebase/database";
...
const handleBarCodeScanned = () => {
data = "PS=1"
const spl = data.split("=");
//GET all students from attendance
let saveList = "";
const dbRef = ref(getDatabase());
get(child(dbRef, `prezente/${spl[0]}/lista_prez${spl[1]}`))
.then((snapshot) => {
if (snapshot.exists()) {
console.log(snapshot.val());
let saveList = snapshot.val().saveList;
saveList += "=";
saveList += props.route.params.saveUserInfo.email;
return saveList;
}
})
.then((saveList) => {
console.log(saveList);
const x = ref(getDatabase());
set(ref(x, `prezente/${spl[0]}/lista_prez${spl[1]}`), {
saveList,
});
});
}