查询中的Dynamodb意外键KeyConditionExpression

时间:2015-08-01 19:12:13

标签: amazon-dynamodb

我正在尝试查询名为“user_path_summary”的表,其值等于我的hashkey,“username”,并且还等于我的全局二级索引hashkey,“full_path”。我希望得到一个属性,“articles_read”。我正在使用的参数是:

var params = {
        "TableName": "user_path_summary",
        "IndexName": "full_path_index",
        "KeyConditionExpression": "full_path = :v_full_path AND username = v:username",
        "ExpressionAttributeValues": {
            ":v_username": {"S" : username},
            ":v_full_path": {"S": full_path}
        },
        "ProjectionExpression": "articles_read",
        "ScanIndexForward": false
    };

我收到以下错误。

{ [MultipleValidationErrors: There were 2 validation errors:
* MissingRequiredParameter: Missing required key 'KeyConditions' in params
* UnexpectedParameter: Unexpected key 'KeyConditionExpression' found in params]
  message: 'There were 2 validation errors:\n* MissingRequiredParameter: Missing required key \'KeyConditions\' in params\n* UnexpectedParameter: Unexpected key \'KeyConditionExpression\' found in params',
  code: 'MultipleValidationErrors',
  errors: 
   [ { [MissingRequiredParameter: Missing required key 'KeyConditions' in params]
       message: 'Missing required key \'KeyConditions\' in params',
       code: 'MissingRequiredParameter',
       time: Sat Aug 01 2015 14:54:52 GMT-0400 (EDT) },
     { [UnexpectedParameter: Unexpected key 'KeyConditionExpression' found in params]
       message: 'Unexpected key \'KeyConditionExpression\' found in params',
       code: 'UnexpectedParameter',
       time: Sat Aug 01 2015 14:54:52 GMT-0400 (EDT) } ],
  time: Sat Aug 01 2015 14:54:52 GMT-0400 (EDT) }

我感到困惑,因为错误与缺少的参数“KeyConditions”有关,后者在query API Reference中被识别为遗留参数,而且还与api参考说明要使用的意外参数“KeyConditionExpression”有关。 “KeyConditions”。

我遗失的地方有没有设置?我的语法在某处搞砸了。请让我知道,我显然遗漏了一些东西。

0 个答案:

没有答案