[DATAMONGO-1997] Add support to return the single deleted item for a deleteBy query method Created: 04/Jun/18 Updated: 05/Nov/19
|Project:||Spring Data MongoDB|
|Reporter:||Eugene Tenkaev||Assignee:||Oliver Drotbohm|
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
|Sprint:||Lovelace RC1, Lovelace GA, Lovelace SR1, Moore RC1, Moore RC2, Moore SR1, Moore SR2|
Please add possibility to delete and return only one item.
But it will be great to have possibility to get only one item if it exists. So it also provides possibiltiy to nicely handle in the REST api situations when user reqeusted deletion of the item that dosen't exists.
So the methods will looks like:
|Comment by Oliver Drotbohm [ 04/Jun/18 ]|
That's a nice idea, Eugene. Note, that as a temporal workaround you can check the list for emptiness or even use long as return type and check for 0 if all you're interested in is whether the method invocation didn't actually end up in a delete.
|Comment by Eugene Tenkaev [ 04/Jun/18 ]|
@olivergierke thanks, for the fast push.
My business requirement was to return deleted entity in JSON. And if no entity is deleted - then send 404.
Right now I think this is even more related to the core org.springframework.data.repository.Repository, org.springframework.data.repository.CrudRepository please check if I'm wrong.
This will also nice addition for the spring-data-rest (wich I'm use).