Reputation: 393
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:
Upvotes: 0
Views: 1293