我正在尝试对 Azure cosmosDB 使用 Criteria Query,但每次都返回空白。我正在尝试传递一个包含 5 个参数的模型,其中一些参数在将模型传递给请求方法时将为空,这是我尝试使用的代码
Map map = new Map();
if(p.getA()!=null || p.getB() !=null || p.getC()!=null || p.getD()!=null){
map.put(p.getA()); //any of them can be null while passing
map.put(p.getB());//any of them can be null while passing
map.put(p.getC());//any of them can be null while passing
map.put(p.getD());//any of them can be null while passing
}
Criteria criteria = Criteria.getInstance(CriteriaType.ARRAY_CONTAINS,"TableA",Collections.singletonList(map),Part.IgnoreCaseType.ALWAYS);
CosmosQuery cosmos = new CosmosQuery(criteria).with(Sort.unsorted());
Iterable<BaseTable> items = cosmosTemplate.find(cosmos,BaseTable.class,"TableA");
现在这个 BaseTable 包含所有表字段,TableA 正在扩展它
public class TableA extends BaseTable{
}
基表
public class BaseTable{
@Id
public String id;
public String A;
public String B;
public String C;
...............
}
任何人都可以告诉我为什么每次我在项目中得到 null 时,标准中缺少什么。