|
function deleteSwap(req, res) { |
|
req.user.swapsForUser.pull(req.params.id); |
|
req.user.swapsForUser.remove(); |
|
req.user.save(function (err, user) { |
When you call .pull(), you are removing it from the array. If you want to use remove, you'd call it with the id method as well.
See the removing subdocs in mongoose https://mongoosejs.com/docs/subdocs.html#removing-subdocs
Slash-Trash/controllers/users.js
Lines 29 to 32 in 93e8f82
When you call
.pull(), you are removing it from the array. If you want to use remove, you'd call it with the id method as well.See the removing subdocs in mongoose https://mongoosejs.com/docs/subdocs.html#removing-subdocs