升级到春天MongoDB的数据后1.10.1,运行查询时,像我得到错误:春数据的MongoDB:可选参数@Query不再工作
@Query("{$and :["
+ "{ $or : [ { $where: '?0 == null' } , { 'field1' : ?0 } ] },"
+ "{ $or : [ { $where: '?1 == null' } , { 'field2' : ?1 } ] },"
+ "]}")
public Page<Entity> findAll(String param1, String param2)
检查错误我看到那里里面的参数子句中没有报价且为我结果,我得到:
org.springframework.data.mongodb.UncategorizedMongoDbException: Query failed with error code 139 and error message 'ReferenceError: test_param_value is not defined :
我看到这里的几个答案,建议的处理可选参数,这种方式((spring-data-mongo - optional query parameters?)),但它不再工作,似乎我无法找到任何东西发布更改日志。
它不知道是什么类型?0或?1,它不能比较undefined == null,因为它不能找出什么是未定义的。希望它是有道理的。 – Euclides