How to delete items in MongoRepository using query annotation?

后端 未结 6 1293
北海茫月
北海茫月 2021-02-05 06:03

I\'m using Spring Data with MongoDB using MongoRepository.

I was wondering if it is possible do a delete by filter using query annotation. I have been looking here and g

6条回答
  •  我寻月下人不归
    2021-02-05 06:50

    Unfortunately spring data doesn't provides any method to delete documents based on a query. And the @Query annotation is only for find documents.

    What you could do is implement a custom repository that deletes documents based on what you want.

提交回复
热议问题