Good day! I am returning two cursors in a meteor publication. The code in question is here:
Meteor.publish('members.checkedIn', function() {
let organizationId = OrganizationService.getOrganizationId(this.userId);
if (!organizationId) return this.ready();
let timeclockQuery = {
organizationId: organizationId,
entityType: 'member',
timeOut: null
};
let timeclocks = Timeclock.find(timeclockQuery).fetch();
let memberIds = _.map(timeclocks, tc => {
return { _id: tc.entityId };
});
let memberQuery = { $or: memberIds };
return Timeclock.find(timeclockQuery).count() == 0 ?
this.ready() : [
Timeclock.find(timeclockQuery),
Member.find(memberQuery)
];
});
Everything works exactly as suspected, all though when in my code I clock out a member (Aka the timeOut field will return one result LESS than before because timeOut !== null
the content on the page is not reactive. Meaning when I renavigate to this page, I see the expected change, but it is not happening 'live' per say. (The member query appears not to be changing once you are subscribed). Should I switch this to be 2 seperate subscriptions? Or can any of you see exactly what I'm doing wrong?
Thanks :)
Extra clarity: The only way to know if a member is 'in the store' is by querying for timeclocks where timeOut is null (Aka they haven't left yet)