I stumbled upon something I thought I understood, but I clearly don’t.
Meteor.publish('users-counts', function(username){
var fields = {
'username':1,
'profile.writtenAboutCount':1,
'profile.authoredCount':1,
'profile.followingCount':1,
'profile.savedCount':1,
'profile.followers':1
}
return Meteor.users.find({username: username},{fields: fields})
})
Meteor.publish('users-profile',function(username){
var fields = {
username:1,
'profile.name':1,
'profile.location.coordinates':1,
'profile.score.up':1,
'profile.tags':1,
'profile.body':1
}
return Meteor.users.find({username:username},{fields:fields})
})
When I go to some pages, I only need users-counts
, which justifies decoupling the subscriptions. When I go to the profile page, I need ALL of the data, so I subscribe to both users-counts
and users-profile
. But when I check to see what the server sent down, it only sent down the fields published by users-profile
.
A fix might be to just publish all of the data in users-profile
also, but keep the users-counts
for when I only need the counts data. But, if I already publish users-counts
before, then wouldn’t that be a waste? I am pretty sure Meteor checks the server cache for that connection and only sends down diff-ed data, so it might not be a waste.
Any clarification or help would be appreciated.
Thanks!