firebase rules for Realtime Database


i have a db:

-users

--UserUid#1
---name:alex
---isUser:true
---isModer:false

--UserUid#2
---name:valder
---isUser:false
---isModer:true
---users
----UserUid#1:true

when user (isUser:true) register in the app he filling another user uid (which have a property isModer:true) and add self uid to his profile (UserUid#2 -> users -> UserUid#1:true).

I have trouble with security rules. As i understand any others who have my db name can edit db. So i found in docs an example

"rules": {
    "some_path": {
      "$uid": {
        ".read": true,
        // or ".read": "auth.uid != null" for only authenticated users
        ".write": "auth.uid == $uid"
      }
    }
  }

But i have a trouble: how to do that if user indicates in registration a some uid just him can edit this uid