【发布时间】:2017-10-02 09:14:26
【问题描述】:
我想在 Spring Data MongoDB 上编写自定义查询。像这样的:
public interface CarRepo extends MongoRepository<Car, String> {
@Query("select distinct(brand) from Car ")
public List<String> findDistinctBrand();
}
但它抛出错误“Caused by: com.mongodb.util.JSONParseException:”。我怎样才能做到这一点?
【问题讨论】:
-
但是在标准中我应该为给定的查询写什么(从 Car 中选择 distinct(brand))?
标签: java mongodb spring-boot