Reputation: 1331
This has been answered with reference to updating single fields but not multiple fields.
When a user registers in my app I write to firebase database a list of fields. The root of the firebase database is users and each user node is a specified unique username.
-users
-username
"name"
"title"
"date of birth"
"location"
"about"
"height"
In UpdateDetailsController is a user update page where they can update some of these fields:
let key = model.ref.child("users").child(currentLoggedInUser).key
let post = [
"name": name.text!,
"title": title.text!,
"about": about.text! ]
let childUpdates = ["\(key)": post]
model.ref.updateChildValues(childUpdates)
While the username remains the same using ref.updateChildValues(childUpdates) overrides the whole node so it looks like:
-users
-username
"name"
"title"
"about"
Advice would be appreciated!
Thx.
Upvotes: 0
Views: 495