Conditionally updating / deleting a document in backend. Should I? Do I assign a PUT, POST, or DELETE http method? Conditionally updating / deleting a document in backend. Should I? Do I assign a PUT, POST, or DELETE http method? mongoose mongoose

Conditionally updating / deleting a document in backend. Should I? Do I assign a PUT, POST, or DELETE http method?


I think the best option would be to use the simple REST model (a PUT to update the document and a DELETE to remove the document).

Then, from your client, you call either the update or the remove method depending on your conditions, as you say. To improve this concept, you can send a negative response to the client concerning the DELETE event if the document can't be removed.