Situation
I have an app in wich users can…
- create new products
- mark products as “favorite”
So User A can “favorite” some products of User B and User C.
This adds the ids of those products to User A’s profile.favorites
Array.
#Problem
When a product is removed I’ll need to update the profile.favorites
Array of every user.
I don’t know how to do this.
I’ve tried something like this:
Meteor.methods({
removeProduct: function(currentProduct){
...
Meteor.users.update({}, {$pull: {'profile.favorites': currentProduct}});
}
});
This gives me the following error:
Error invoking Method 'removeProduct': Internal server error [500]
Any ideas, where I’m going wrong?