Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

remove specialty

View gist:3977137
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
removeSpecialty: function(options) {
var userId = options.userId;
var toRemove = options.specialty || {};
var topic = Topics.findOne({name:toRemove.name});
var user = Meteor.users.findOne(userId)
if(!user)
throw new Meteor.Error("User not found")
if(!topic)
throw new Meteor.Error("Topic not found")
var current = _.map(user.profile.specialties, function(obj){return obj._id})
if(_.isObject(topic)) {
if(_.contains(current,topic._id)) {
Meteor.users.remove({_id: topic._id})
}
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.