javascript - Best Practice Data Relationships and Selecting with Firebase -
i have tried understand how structure data in firebase, i'm struggling apply examples have, advice great. image of database structure
i have list of portfolios. each portfolio has name , own key (probably bad practice, couldn't work out how key in js).
i have list of orders. each order has name , portfolio attribute set key of portfolio belongs to.
- do have store order id's in portfolio?
- how list of orders order.portfolio equals portfolio.key?
i've tried use equalto, don't think i'm using correctly.
firebase.database().ref("orders").orderbychild("portfolio").equalto(thisref.portfolio.key).on('value', function(snapshot) { var orders = snapshot.val(); });
see answer related question here: what's best way of structuring data on firebase?
i'm practical terms download data local "store" , "join" data need based on i'd on record. so
- yes
- download both sets on app initiation , use loop or lodash filter orders given portfolio
Comments
Post a Comment