AWS DynamoDB filterexpression具有多个IN条件子句和QueryRequest

时间:2018-10-25 14:28:04

标签: amazon-web-services amazon-dynamodb dynamodb-queries

当我们在QueryRequest中使用多个IN条件子句时,只有与IN条件中提供的第一项匹配的数据。

我的Json格式具有

{
[
  {
   CID:1,
   PId:1,
  },
  {
   CID:2,
   PID:2,
  }
],
Age:30,
STATE:[
    "AP", "TS"
],
Brands:[
  "SAMSUNG","NOKIA","LG"
]
} 

var filterExpression = " ((#CID= :CID1 and #PID = :PID1) or (#CID = :CID2 and #PID = :PID2)  and #State in ( :state1, :state2) and #Brands in ( :brands1, :brands2)";
                // Create Query request
                QueryRequest request1 = new QueryRequest
                {
                    TableName = "Table1",
                    IndexName = "Age-index",
                    KeyConditionExpression = "Age = :Age",
                    FilterExpression = filterExpression,
                    ExpressionAttributeNames = expressionAttributeNames,
                    ExpressionAttributeValues = expressionAttributeValues
                };

                var result = await dynamoClient.QueryAsync(request1);

0 个答案:

没有答案