Skip to content

Instantly share code, notes, and snippets.

@johanbrook
Last active January 15, 2016 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johanbrook/a347c2b65a0c7c76237d to your computer and use it in GitHub Desktop.
Save johanbrook/a347c2b65a0c7c76237d to your computer and use it in GitHub Desktop.
Meteor.publish('nightclub', (nightClubId) => {
check(nightClubId, String);
const clubFields = {name: 1, managers: 1};
const managerFields = {profile: 1, emails: 1};
const clubCursor = Nightclubs.find(nightClubId, {limit: 1, fields: clubFields});
const managerIds = _.pluck(clubCursor.fetch(), 'managers');
const managersCursor = Meteor.users.find({_id: {$in: managerIds}}, {fields: managerFields});
return [clubCursor, managersCursor];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment