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
Repository:
@Component public interface SomeRepository extends MongoRepository { @Query("{ '_id' : ?0 }") SomeObject findById(String _id); }
Code in some class:
@Autowired private SomeRepository pRepo; public void delete(String id) { pRepo.delete(pRepo.findById(id)); }