我使用的是SpringData和ReactiveMongoRepository。我想从年龄为40岁的人员集合中删除文档。
public interface PersonRepository extends
ReactiveMongoRepository<PersonEntity, Long> {
Mono<Long> deletePersonEntitiesByAge(Long age);}但它不起作用。我将springframework.data的日志级别设置为debug,这是打印的日志。
o.s.d.m.r.query.MongoQueryCreator - Created query Query: { "age" : 40 }, Fields: { }, Sort: { } 但什么都不是。
发布于 2020-10-07 03:40:17
对我来说,它只适用于完整的实体:
interface GameRepository extends ReactiveMongoRepository<Game, String> {
@DeleteQuery(value = "{'lastUpdated': { $lt : ?0 }}")
Flux<Game> deleteOlderThan(LocalDateTime dateTime);
}https://stackoverflow.com/questions/62177138
复制相似问题