Meteor Users collection vs additional collection -


i'n trying figure out, what's best practice building collections associated user's data.(in terms of reactive, queries speed, or other.) example, what's better? meteor.users.profile: {friends, likes, previous orders, locations, favorites, etc"}. or create additional collection keep data, example: meteor.userinfo.user{friends, locations, previous orders, etc"). thanks.

share|improve question

closed broad paul stenne, tushar, mogsdad, paul roub, jal jan 28 '16 @ 23:06

please edit question limit specific problem enough detail identify adequate answer. avoid asking multiple distinct questions @ once. see how ask page clarifying question. if question can reworded fit rules in help center, please edit question.

up vote 1 down vote accepted

use users collection store information user isn't related other collections. typically should @ top level of user document, not inside profile. thing i'd expect see in profile profile information (and not, instance, list of previous orders).

things previous orders shouldn't there since can query orders collection find them. performance reasons is useful denormalise data, should exception, not rule.

share|improve answer
    
thanks, if have dashboard want see user's info, have run queries collections id. doesn't makes sense keep on collection (usersinfo) user's ref info, , query collections directly ref id? other way around? – avi a jan 21 '16 @ 9:26
1  
denormalising data hard work. every time add/remove order, instance, need update user too. code more complex, there more room bugs. it's unnecessary. time justified performance enhancements, , dashboard hardly seems necessary. can denormalise later if needed. – tarmes jan 21 '16 @ 9:30
    
got it. calllbacks each method hard , dangerous work. manipulating insert id user's id? _id: createdby--uuid? – avi a jan 21 '16 @ 9:51
1  
absolutely not. there's no difference in search speed, ensure have index on createdby field. – tarmes jan 21 '16 @ 13:06
1  
related question: stackoverflow.com/questions/34919413/… – mre jan 21 '16 @ 17:12

not answer you're looking for? browse other questions tagged or ask own question.

Comments