There are multiple approaches to solving this issue, and you highlighted one in your response.
1) One way is to query all users where the group is 'users', iterate through each user, and update their group to 'moderators'.
2) Adding some structure:
users
uid_0
"date_of_birth": "June 23, 1912",
"full_name": "Alan Turing",
"group": "-UY89j99j9jasd",
"nickname": "Alan The Machine"
uid_1
"date_of_birth": "June 23, 1912",
"full_name": "Alan Turing",
"group": "-Y888jasjdjaos",
"nickname": "Alan The Machine"
uid_2
"date_of_birth": "June 23, 1912",
"full_name": "Alan Turing",
"group": "-UY89j99j9jasd",
"nickname": "Alan The Machine"
And defining the groups:
-UY89j99j9jasd
group_name: "users"
-Y888jasjdjaos
group_name: "dudes"
To convert current users from 'users' to 'moderators', simply change the group name to 'moderators'. This allows for easy modifications in case different terminology is preferred.
-UY89j99j9jasd
group_name: "moderators" //or 'people who pwn'
-Y888jasjdjaos
group_name: "dudes"
3) Reversing the logic by storing users in a moderator or users node:
users
uid_0
"date_of_birth": "June 23, 1912",
"full_name": "Alan Turing",
"nickname": "Alan The Machine"
uid_1
"date_of_birth": "June 23, 1912",
"full_name": "Alan Turing",
"nickname": "Alan The Machine"
uid_2
"date_of_birth": "June 23, 1912",
"full_name": "Alan Turing",
"nickname": "Alan The Machine"
Defining the groups:
-U8asdjoasjds
group_name: "moderators"
members:
uid_0: true
uid_2: true
-Yuiis9isisis
group_name: "users"
members
uid_1: true
This structure allows for efficient transfer of users between groups and renaming them as needed.
4) An alternative method:
administrators
uid_0: true
uid_2: true
users
uid_1: true
This method follows a similar concept as #3 but distinguishes groups based on keys. Although it's generally advised to separate key names from data content, in this scenario it may be acceptable.