Last active
January 15, 2016 12:50
-
-
Save johanbrook/a347c2b65a0c7c76237d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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