Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete items in MongoRepository using query annotation?

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 google and I cannot find any documentation.

like image 391
paul Avatar asked Sep 02 '25 15:09

paul


1 Answers

@Query(value="{'id' : $0}", delete = true)
public Person deleteById (String id);
like image 114
Marcelo Pasut Avatar answered Sep 05 '25 06:09

Marcelo Pasut