From this post, I know that I cannot accomplish what I need with the code I currently have shown below. However, all of the documentation I have come across doesn't give a use case of needing to provide an OR condition to the remove()
function in mongoose and I am not sure how that would be structured. I need the following to work somehow...
router.delete('/friend/:id',function(req,res){
var response = new Response();
Message.find().or([{'from.id':req.user.id},{'to.id':req.user.id}]).exec(function(err,messages){
_.each(messages,function(message){
message.remove(function (err,message) {
})
});
});
res.send(response.complete());
});