EDITED
i have to add a new pair of key:values in the node utenti in my Firebase database structured as below, but without deleting previous pairs already stored in db
I get those pair from an array of custom objects where I have stored all user I have to add
so with for cycle:
for user in self.usersarray {
let utentiRef = root.child("groups").child(groupId!).child("utenti")
let refToAdd = utentiRef.child(user.id!)
refToAdd.setValue(true)
}
it works and add all the users in the array but it overwrite previous users already stored on firebase.
I noticed that when from another view controller i run
root.child("groups").child(groupId!).child("utenti").updateChildValues([user.id!: true])
the single user is added without overwriting, so where is the problem??