When I upload data to the fire base realtime database it uploads everything perfectly but when I register a new user the previous users data gets deleted every time a new user is created
this is the code I use to upload the data:
private fun uploadUserDataToDatabase(email: String) {
var uid = mAuth.currentUser?.uid
var user = User(email)
myRef.child(uid!!).setValue(user)
}
This is what the data base looks like after a user has registered:
This is what the database looks like after a nother user registers:
How do i get it to not delete the previous user everytime a new user is registered?
if i change it to
myRef.child(uid!!).push.setValue(user)
it uploads the data twice and looks like this:



firebase-realtime-database, but incloud-firestorethere is a function.add()which does not override the old value. So I would try.addValue()instead of.setValue()push(). If tht is not what you want, edit your question to show the JSON you want to get.