2016-11-22 27 views
0

我正在嘗試使AWS.dynamodB.document()。batchGet工作。 我PARAMS:DynamodB Batchget錯誤

{ 
    "RequestItems":{ 
     "Places":{ 
      "Keys":[ 
       { 
        "id":"ChIJ-cJN7tlx5kcRG3I5nIqlJvM" 
       } 
      ] 
     } 
    }, 
    "ReturnConsumedCapacity":"TOTAL" 
} 

現在我收到此錯誤:當我使用AWS.dynamodB.batchGetItem具有相同PARAMS它的工作,但

{ 
    "errorMessage": "Reflect is not defined", 
    "errorType": "ReferenceError", 
    "stackTrace": [ 
     "Module._compile (module.js:409:26)", 
     "Object.Module._extensions..js (module.js:416:10)", 
     "Module.load (module.js:343:32)", 
     "Function.Module._load (module.js:300:12)", 
     "Module.require (module.js:353:17)", 
     "require (internal/module.js:12:17)" 
    ] 
} 

我有一個瘋狂的JSON

+0

我想知道答案是否有助於解決該問題? – notionquest

+0

是的,謝謝,它的工作! – sepiropht

回答

0

我的表具有散列和排序鍵。下面的參數正在爲我工​​作。

var params = { 
    "RequestItems" : { 
     "Movies" : { 
      "Keys" : [ { 
       "yearkey" : {N : "2016"}, 
       "title" : {S : "The Big New Movie 1"} 
      } ] 
     } 
    }, 
    "ReturnConsumedCapacity" : "TOTAL" 
}; 

dynamodb.batchGetItem(params, function(err, data) { 
    if (err) { 
     console.error("Unable to read item. Error JSON:", JSON.stringify(err, 
       null, 2)); 
    } else { 
     console.log("GetItem succeeded:", JSON.stringify(data, null, 2)); 
    } 
}); 

請嘗試下面的場景。

var params = { 
     "RequestItems" : { 
      "Places" : { 
       "Keys" : [ { 
        "id" : {S : "ChIJ-cJN7tlx5kcRG3I5nIqlJvM"}     
       } ] 
      } 
     }, 
     "ReturnConsumedCapacity" : "TOTAL" 
    }; 
相關問題