Query interceptor for spring-data-mongodb for soft deletions
问题 I want to add where condition to all repository fetching methods for not viewing deleted items. In Spring JPA it's possible to add @Where annotation to Entity. But for Spring Data MongoDB AFAIK it's not possible. Tried Mongodb lifecycle events but not succeeded. Is there a way of modifying repository queries before execution. 回答1: Can you explain what do you mean with "viewing deleted items"? If you want, you can use MongoTemplate and write your own repository and so can add desired where