I have a simple Firebase function that updates some data. However, the interpreter says that the first argument contains \"undefined\" in property \'users.tester1\'. Can somebod
Like said above, you need all undefined
values to be null
if you want them to save as empty values in firebase.
I take this approach to correct all nested values.
//to search and replace
const replaceAll =(s="",f="",r="")=> s.replace(new RegExp(f.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), r)
//to save
firebase.database().ref(`path`).update(JSON.parse(replaceAll(JSON.stringify(val),"undefined","null")))