How to delete an array item in meteor using mongo?

meteor, mongodb, mongodb-query

Solution

Ah, I just had to change "$unset" to "$pull". I added via "$push" so I thought, "Is there a $pull method?" And there was! :)

Groups.update( {"_id": groupID }, {"$pull": { "members" : {"firstName": firstName, "lastName": lastName} } } );

Problem

I have this app I'm working on... http://stevedavis.meteor.com/ You can see the contents of the group collection by doing a 'Groups.find()' in the console. I have this in my JS... ``` Template.listGroups.events({ 'click .deleteMember': function(){ var groupID = this.groupID, firstName = this.firstName, lastName = this.lastName; } }); ``` So, I wanna be able to delete a member from a group if I click the X next to their name. I've tried... ``` Groups.update( {"_id": groupID }, {$unset: { "members" : {"firstName": firstName, "lastName": lastName} } } ); ``` but it removed ALL members. I only want it to remove the members item that matches the first and last name of the element clicked. Thanks.

Original source