Master detail collections > reactivity


I am working on an event app, where an exhibitor scans a QR code to checkin a visitor. Visitor data is stored in the Meteor users collection and the scan tstamp in a eventvisitors collection, with data like exhibitorId and visitorId .

In the CMS i want to retrieve the visitor data, related to the exhibitor and the checkin tstamp.

I know there are several ways to do this. One of which is to save all the data in the same collection, use a package for this … I looked into these options and decided i prefer to do it differently.

I chose to create another collection based on the data from the visitor and eventvisitors collection, being compile when subscribe to it.

I have this publication:

Meteor.publish('getExhibitorVisitors.byExhibitorId', function (exhibitorId) {
  const publication = this;
  const exportexhibitorvisitorsCursor = ExhibitorVisitors.find({ exhibitorId });
    added: function (id, exhibitorVisitor) {
      console.log('exportEventVisitors.all added', id, exhibitorVisitor);
      const user = Meteor.users.find({ _id: exhibitorVisitor.visitorId, role: 'visitor' }, {
        fields: {
          fName: 1,
          lName: 1,
          company: 1,
          contactEmail: 1,
      // keep original visitorId
      user.visitorId = exhibitorVisitor.visitorId;
      user.createdAt = exhibitorVisitor.createdAt;
      publication.added('exportexhibitorvisitors',, user);
    changed: function (id, exhibitorVisitor) {
      console.log('exportEventVisitors.all changed', id, exhibitorVisitor);
      // publication.changed('exporteventvisitors', id, transformExportEventVisitor(visitor));
    removed: function (id) {
      console.log('exportEventVisitors.all changed', id);
      // publication.removed(id);

and client

Template.pageExhibitorView.onRendered(function onExhibitorEditRendered() {
  const data = Template.currentData();
  Meteor.subscribe('getExhibitorVisitors.byExhibitorId', data.exhibitorId);

Is this a good solution? As i need to keep reactivity
When i subscribe I see that it triggers the publication to be run twice on the server.

Any better ideas?