I'm trying to write a rule for my iOS app which is using firebase to have a unique user name .I've been stuck for two days and any help would be appriciated This the firebase db rule that I'm trying to execute
{
"rules": {
".read": "auth != null",
".write": "auth != null",
"Users":{
"$uid":{
"userName":{
".validate": "!root.child('userName').child(newData.val()).exists()"
}
}
}
}
}