I have the following document structure for MongoDB
{
partnerName: 'Zumba Fitness',
supportedProducts: [
'FitBit',
'Protein Powder'
]
}
At the moment I have a delete operation for my Node service, where I am deleting the entire object based on the partnerName.
delete: function (req, res) {
var removePartner = req.params.partnerName;
var promise = Partner.find({ partnerName: removePartner }).remove().exec();
promise.then(function removePartner(val) {
console.log('partner value removed');
var response = { message: 'Partner Deleted' };
res.status(200).send(response);
}).catch(function catchError(err) {
console.error(err);
res.status(500).send(err);
});
}
How would I modify the above functionality, if I wanted to delete a specific supportedProducts value? For instance if I only wanted to delete "FitBit" in the above document object