I have this structure
"Following": {
".validate": newData != null && newData.child(count).val() == root.child(Following).child($User).child(count).val() + 1),
"$User": {
"$Following": {
"created": {}
},
"count": {}
}
}
i want to prevent that the count variable can be incremented or decremented without the creation or the delete of a following
for prevent the increment without the creation of a new following i add this rule
".validate": newData != null &&
newData.child(count).val() ==
root.child(Following).child($User).child(count).val() + 1)
but i have problem to prevent the decrement without the delete of a following.
the my ask is this
how can I decrease the count variable only if I know that the Following is going to be deleted ?
sorry for bad english :/