publications.js 547 Bytes
import { Meteor }                         from 'meteor/meteor';
import { check, Match }                   from 'meteor/check'

import { Orgs }                           from '/imports/collections/orgs/index';
import { Users }                          from '/imports/collections/users/index';
import { Parents }                        from '/imports/collections/parents/index';

Meteor.publish('parent.forMyOrg', function () {
  const user = Users.findOne({_id: this.userId});
  if(!user) return [];
  return Parents.find({orgId: user.orgId});
});