I am trying to write rules to protect the database. But I am confused by writing a rule that will prevent the removal of any node from the database. I read about newData.exists, but when I tried to run it in the simulator, the deletion was done! How can a node be deleted by setting its value to zero, so I tried to simulate the value of node equal to null, and it was successful, which is undesirable.
Suppose I have this node:
root{
Number of Users:20
}
And I wrote these rules:
"Number of Users":{
".read":true,
".write":"auth!==null && newData.exists()"
}
I'm making any mistake, please correct me.
source
share