Firebase child nodes are randomly deleted in random times
I have a firebase project with a lot of children per node (in the range of 100k+) and it uses real time database. The problem is, sometimes, completely randomly, few child items simply get removed.
For example, given the following database structure:
**Project** (root)
users
user1
user2
user3
.
.
.
user100000
one of the nodes among user1, user2... user100000 would just randomly get removed. This happens so randomly out of nowhere, I cannot reproduce it, and only affects less than 1% of the time, so out of more than 100k children, only 200ish would disappear in the span of 3 month. I went through every line of the code, but there is no function that removes a node. I only use updateChildValues
, observe(.childAdded...
, observeSingleEvent
, and queryOrdered
. There is no single method that starts with remove
. Any ideas on why this is happening?
My first intuition is I am calling some write API like setValue
or updateValue
with Nil
, but I am on Swift and that is not possible. I also looked at Firebase Web update() deletes all other child nodes, but this actually removes every child other than the one being added, which is definitely not happening to me. Has anyone also experienced this issue? Any help would be really appreciated. Thank you.
-----EDIT-----
Here are some example APIs that I use with write function. item variable is a dictionary defined by let.
let databaseRef = Database.database().reference()
newReferece = databaseRef.child("users").child(UID)
newReferece.setValue(item)
Another one:
theAPI.REF?.updateChildValues(dict, withCompletionBlock: { (error, ref) in
if error != nil {
onError(error!.localizedDescription)
} else {
onSuccess()
}
})