data modeling - How model multiple 1-to-n relationships in firebase? -
i'm coming parse firebase , want implement project non-trivial 1-to-n relationships follows:
- entity --1-to-n--> person
- person --1-to-n--> credit
- creditor --1-to-n--> credit
data write , read — added clarification
person , related credit created @ same time.
each person may read / update each of own credit few times.
then read creditor: run queries gather credit of given creditor.
looking @ firebase's documentation would have use relationship below, wonder if i'm thinking correctly.
{ "entities": { "entitya": { "name": "...", "persons": { "persona": true, "personb": true, "...": true } }, "entityb": { "name": "...", /* ... */ } }, "persons": { "persona": { "name": "...", "entity": "entitya", "credits": { "credita0": true, "credita1": true, } }, "personb": { "name": "...", /* ... */ } }, "credits": { "credita0": { "amount": "2000,00", /* ... */ "institution": "institutiona" }, "credita1": { "amount": "5000,00", /* ... */, "institution": "institutionb" } }, "institutions": { "institutiona": { "name": "...", "credits": { "credita0": true } }, "institutionb": { "name": "...", "credits": { "credita1": true } } } }
Comments
Post a Comment