Firebase data modeling guidance -
at risk of being tagged duplicate, here goes.
i have items , tags. items can have many tags, , each tag can child tag of tag.
i want list tags tree, , items inside each tag.
in essence, tag folder items, except item can in multiple locations.
is right way?
/items/ i123 : { label : "i item", tags : { tagid: t234} } /tags/ t234 : { label : "i tag", parent: {tagid: t567} }
im bit unsure i'm doing right. did read through demoralizing document , tutorial @ firebase of course , did @ other similar questions.
i'm stuck in rdbms-think , seem unable grok nosql concepts, that's why hope guidance here use case here.
thanks.
per request commenters, more info on use case.
i'm trying display tree of tags, this
i tag 1 second tag child tag here child's child tag child tag root level tag again // etc... idea
there items, , items can in multiple tags. display here in file browser, really. except here, items can located in multiple places, i.e. can have multiple tags associated.
like example, item 334
sits in multiple places:
tag 1 item 209 tag 2 tag 21 item 11 item 334 tag 3 item 334 item 586
right now, think store whole thing in 1 json object, , update needed, i'm interested in being searchable tag item label. in feeble newbie mind, assume should able have url /tags/
can traverse items matching tags. ditto /items/
can keyword match on labels.
other answers on describe ways create indices things, that's why i'm storing tag references in item object. i'm struggling details around this.
the more think it, more inclined store in 1 big nested object, think that's supposed not idea. , particularly dislike idea of having item stored multiple times if did that.
life easier in rdb world, because knew doing :p
this structure meets criteria of question there's not information in question put solid answer together.
items item_00 tag_00 tag_01 tag_02 item_01 tag_02 item_02 tag_01 tags tag_00 parent: false child: tag_01 tag_01 parent: tag_00 child: false tag_02 parent: false child: false
in example,
- items can have many tags
- each tag can child of tag (and parent:child relationship tracked)
- the tags listed tree
- items inside each tag can found querying items tag number
update question more data , (we) can refine answer)
Comments
Post a Comment