2015-02-17 58 views
0

我想在dynamodb 我想在4场 rule0这是独一无二的,因此hash keywhich_ruleGlobal Index搜索多个列执行queryrule1Global Indexrule2Global IndexDynamodb查询不能

我搜索rule0然后rule1然后rule2 我正在使用以下函数来匹配rule1原因匹配不rule0

function dynamoQueryRule1(rule0, rule1, funcQ) { 
    which_rule = "rule1"; 
    var q = { 
     "KeyConditions": { 
      "rule0": { 
       "ComparisonOperator": "EQ", 
       "AttributeValueList": [{ 
         "S": rule0 
        }] 
      } 
     }, 
     "TableName": "tbl_scripts" + table_prefix, 
     "AttributesToGet": ['id'], 
     "ConditionalOperator": "AND", 
     "QueryFilter": { 

        "which_rule": { 
         "ComparisonOperator": "EQ", 
         "AttributeValueList": [{ 
           "S": which_rule 
          }] 
        }, 
        "rule1": { 
         "ComparisonOperator": "EQ", 
         "AttributeValueList": [{ 
           "S": rule1 
          }] 
        } 
     } 
    }; 
    var params = { 
     TableName: this.options.tbl_name 
    }; 

找到,但这个功能是从来没有得到结果rule1。即使我已经在dymamo table中创建了这些规则。 要检查发电机数据,我已检查scan其工作正常,但scan有1mb的限制,并不完美的用例,我的问题。 请帮我找到query格式的错误。

回答

0

检查您的响应对象是否有[LastEvaluatedKey]!= null。

如果设置了[LastEvaluatedKey],则表示您尚未查询整个数据集(同样是因为1M限制)。因此,您需要再次调用查询,在查询中设置ExclusiveStartKey =上一个响应中的LastEvaluatedKey。 (附加组合的结果)

这类似的问题,显示了如何做到这一点在node.js中的语法: Recursive Fetch All Items In DynamoDB Query using Node JS