In the Firebase official guides,
// An index to track Ada's memberships
{
"users": {
"alovelace": {
"name": "Ada Lovelace",
// Index Ada's groups in her profile
"groups": {
// the value here doesn't matter, just that the key exists
"techpioneers": true,
"womentechmakers": true
}
},
...
},
"groups": {
"techpioneers": {
"name": "Historical Tech Pioneers",
"members": {
"alovelace": true,
"ghopper": true,
"eclarke": true
}
},
...
}
}
This is a necessary redundancy for two-way relationships.
If I want to develop an App with that model, when a user joins a new group, does that client application make 2 requests to my Firebase for adding 2 record?
If something goes wrong in the middle of operations. What should I do? Maybe I need a backend server that periodically check data conflicts?
I can't find any further elaboration on this data redundancy issue on Firebase documentation or in articles about NoSQL (maybe I was using wrong keywords!).
Furthermore, what is the difference between indexing my data and the above approach?