Skip to content

Instantly share code, notes, and snippets.

@mokolodi1
Last active October 28, 2016 23:58
Show Gist options
  • Save mokolodi1/29927da6b8448685dd5a9c05d119516c to your computer and use it in GitHub Desktop.
Save mokolodi1/29927da6b8448685dd5a9c05d119516c to your computer and use it in GitHub Desktop.
// publish users that are in the specified collaborations
Meteor.publish("usersInCollaborations", function (collaborations) {
// grab the associated collaborators (personal and otherwise) for all collaborations
let combinedCollabs = _.reduce(collaborations, (memo, name) => {
// grab the collaboration
let collab = Collaborations.findOne({ name });
// get the collaborators and add them to the working list
memo.concat(concat.getAssociatedCollaborators());
return memo;
}, []);
return Meteor.users.find({
"collaborations.personal": { $in: combinedCollabs }
}, {
fields: {
"profile.name": 1
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment