我正在将 MongoDB 与Spring Boot 2.0.1.RELEASE
. 一切似乎都运行良好。我能够使用 MongoRepository 正确执行 CRUD 操作。当我使用 mongodb 查询时
@Query(value = "{address.city:?0}")
public List<Hotel> findByCity(String city);
@Query(value = "{address.country:?0}")
public List<Hotel> findByCountry(String country);
当我尝试使用 url 访问数据时localhost:8090/hotels/address/city/Rome
,我收到以下错误作为响应
{
"timestamp": "2018-05-04T04:51:43.549+0000",
"status": 500,
"error": "Internal Server Error",
"message": "Invalid JSON input. Position: 9. Character: '.'.",
"path": "/hotels/address/city/rome"
}
和以下登录控制台:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.bson.json.JsonParseException: Invalid JSON input. Position: 9. Character: '.'.] with root cause
org.bson.json.JsonParseException: Invalid JSON input. Position: 9. Character: '.'.
我不知道为什么我Invalid JSON input. Position: 9. Character: '.'.
在执行GET
请求时会收到?
我哪里错了?