Spring数据mongo无法保存未找到属性类型的GeoData b / c

时间:2017-05-30 12:48:12

标签: spring mongodb spring-data spring-data-mongodb

当尝试使用geoData更新对象时,spring数据mongo会抛出ff异常

org.springframework.data.mapping.context.InvalidPersistentPropertyPath: No property type found on org.springframework.data.mongodb.core.geo.GeoJsonGeometryCollection!

示例对象结构就像这样

class Location{
    ....
    @GeoSpatialIndexed(type = GeoSpatialIndexType.GEO_2DSPHERE)
    GeoJsonGeometryCollection geomerty
}

存储库

interface LocationRepository extends MongoRepository<Location, String> {

}

保存方法(在更新时调用)

//the exception is thrown here
locationRepository.save(updatedLocation) 

我没有添加类型字段,它是由 GeoJsonGeometryCollection 对象添加的。

欢迎任何解决方法。

1 个答案:

答案 0 :(得分:0)

当我将spring boot版本从1.3升级到1.4时,它开始工作了