Suppose I have a typical user and group data model where a user can be in many groups and a group can have many users. It seems to me that firebase docs recommend modeling my data by replicating user identifiers within groups and group identifiers inside such users:
{
"usergroups": {
"bob": {
"groups": {
"one": true,
"two": true
}
},
"fred": {
"groups": {
"one": true
}
}
},
"groupusers": {
"one": {
"users": {
"bob": true,
"fred": true
}
},
"two": {
"users": {
"bob": true
}
}
}
}
To maintain this structure, whenever my application updates one side of a relationship (for example, adds a user to a group), it also needs to update the other side of the relationship (for example, add a group to a user).
, - - , . , , , firebase.
firebase , , , , .
, , :
{
"memberships": {
"id1": {
"user": "bob",
"group": "one"
},
"id2": {
"user": "bob",
"group": "two"
},
"id3": {
"user": "fred",
"group": "one"
}
}
}
"user" "group" firebase ".orderByChild(" "). equalTo (...)" ".orderByChild(" group "). equalTo (...)" .
? , ? , ?