我在mongo shell中有这样一个查询可执行文件:
db.devices.find({_id: {$gt: ObjectId("5fd931e00000000000000000")}})
我想把它写在spring-boot-reactive-mongo数据中,我的尝试看起来失败了:
@Service
public class MongoService {
@Autowired
private final ReactiveMongoTemplate mongo;
public MongoService(ReactiveMongoTemplate mongo) {
this.mongo = mongo;
}
public Flux<Device> getObjectsByTimestamp(String timestamp) {
Query query = new Query(Criteria.where("_id").gt("5fd931e00000000000000000"));
return mongo.find(query, Device.class, "devices");
}
}
1条答案
按热度按时间km0tfn4u1#
能够通过以下方式解决问题: