ios - How do I associate a firebase sub-entry to a main entry? (explanation in comments) -
the json:
{   "coffee-shops" : {     "-kj4i4d-jrqrzc9wp42c" : {       "coffeeshopname" : "starbucks",       "coffeeshoprating" : 3.5,     "-kj4vvb51wx9npektjxq" : {       "coffeeshopname" : "starbucks",       "coffeeshoprating" : 1,       "coffeeshopreview" : "r",       "coffeeshopreviewername" : "charles"     },     "-kjej6mpqwohcay_9k6v" : {       "coffeeshopname" : "starbucks",       "coffeeshoprating" : 4,       "coffeeshopreview" : "b",       "coffeeshopreviewername" : "charles"     }   }   },   "users" : {     "02a54e06-9635-4e22-9bb7-c0ddcd9c6f4f" : {       "email" : "charles@gmail.com",       "provider" : "password",       "username" : "thecoffeeguy"     },     "03fe2c17-3c66-442c-a63d-4a1e02fd660c" : {       "email" : "test@gmail.com",       "provider" : "password",       "username" : "charles"     },     "16a7279f-5478-4f3f-b5f8-2f261d166d92" : {       "email" : "tester@gmail.com",       "provider" : "password",       "username" : "haha"     },     "23275f65-8e16-4ede-9236-21485b7493b9" : {       "email" : "boo@gmail.com",       "provider" : "password",       "username" : "boo"     },     "a5ed6962-76bc-476a-b432-6787e45badfc" : {       "email" : "mesbekmek@gmail.com",       "provider" : "password",       "username" : "mesbekmek"     }   } } some context: i'm making coffee app , need have reviews specific coffee shop user at. right now, reviews have ever been made show on tableview.
this isn't "how code" question, me wondering how approach , how might solve it.
this think should do:
- get specific coffee shop's uuid 
- iterate on reviews because sub-entries in coffee shop model 
- get data iterating on reviews, see if uuid of cell(?) selected matches review uuid 
this doesn't sound right me, great.
you can organize db in different way.
coffee-shops: |--coffeeid1 |--coffeeid2 |--coffeeid3  reviews: |--coffeeid1 |----reviewid1 |----reviewid2 |--coffeeid2 |----reviewidx |----reviewidxx when insert review can use same key of coffee-shop.
 in way reviews of same coffee shop under same ref.
you can achieve using this:
ref(reviews).child(coffeeshop.getkey()).push();