I want to add users to database with unique usernames. The problem is that user with the same username gets created but without username field. here's my rules :
"users": {
"$uid": {
".write": "auth !== null && auth.uid === $uid ",
".read": "auth !== null && auth.provider === 'password'",
"Username": {
".validate": "
!root.child('usernames').child(newData.val()).exists() ||
root.child('usernames').child(newData.val()).val() == $uid"
}
}
},
"usernames": {
".read": true,
".write": true,
}
I store unique usernames in "usernames" table
I don't want upper node to be created in users table. How do i change rules to achieve that?
