spring-projects / spring-projects/spring-data-mongodb
BeforeDeleteEvent<DocumentType> when calling 'deleteAll()' on repository. [DATAMONGO-2471]
@christophstrobl is already working on this.
Since Dec 30, 2020.
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
hoemich opened DATAMONGO-2471 and commented
Given a Repository<DocumentType, KeyType> repository, when I call
repository.delteAll()
an BeforeDeleteEvent is beeing published. However I won't get it in my AbstractMongoEventListener.
On the other hand, an EventListener like
@EventListner
public void onEvent(BeforeDeleteEvent event)
{}
gets it. In the debugger it then looks like this:
event = BeforeDelteEvent@xxx
type = null
document = {Document@yyy} size = 0
collectionName = "theCollection"
timestamp = 12345678990
source = {Document@yyy} size = 0
So currently I can use the collection name to match it to the right Repository and deduct that this is a deleteAll event.
It would be nice if I could handle this event somehow in the AbstractMongoEventListener either in the onBeforeDelete or in some other overridable method. If that is technically possible
Affects: 2.2.4 (Moore SR4)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.