Each UserID could register an alias ID.
UserID might be provided after authentication.
Categories > Firebase > rex_firebase_userid2idIntroductionLinksDependenceUsageData structure on firebaseRandom number IDGet IDGet UserIDRemove UserIDSpecific IDSet IDGet UserIDRemove UserIDRules of data indexing
<sub-domain>\ <ID> - UserID
One-to-one mapping between UserId and alias ID.
UserID --> ID
Action:Get random ID
Callback
Success : Condition:On request ID
Expression:UserID
, Expression:ID
Failed : Condition:On request ID error
Expression:LastErrorMessage
, Expression:LastErrorCode
Expression:UserID
ID --> UserID
Action:Get user ID
Callback
Success : Condition:On request User ID
Expression:UserID
, Expression:ID
Failed : Condition:On request User ID error
Expression:LastErrorMessage
, Expression:LastErrorCode
Expression:ID
Action:Remove User ID
Callback
Success : Condition:On remove User ID
Expression:UserID
Failed : Condition:On remove User ID error
Expression:LastErrorMessage
, Expression:LastErrorCode
Expression:UserID
Action:Try set ID
Callback
Success : Condition:On request ID
, if UserID has not been registered
Expression:UserID
, Expression:ID
Failed : Condition:On request ID error
Expression:LastErrorMessage
, Expression:LastErrorCode
Expression:UserID
See section of Get UserID
in Random number ID
.
See section of Remove UserID
in Random number ID
.
Add data indexing rule to improve the query performance. (Reference)
Assume that sub domain is UserID-ID
:
xxxxxxxxxx
{
"rules": {
".read": true,
".write": true,
"UserID-ID": {
".indexOn": ".value"
}
}
}