2016-11-22 6 views
0

Ich versuche derzeit, AWS.dynamodB.document(). BatchGet arbeiten. Mein params:Fehler mit DynamodB Batchget

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

Im Moment bin ich immer diese Fehlermeldung:

{ 
    "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)" 
    ] 
} 

Wenn ich AWS.dynamodB.batchGetItem mit den gleichen params verwenden ‚es Arbeit, aber Ich habe eine wahnsinnige JSON

+0

Ich frage mich, ob die Antwort hilfreich war das Problem zu lösen? – notionquest

+0

ja danke, es hat funktioniert! – sepiropht

Antwort

0

Meine Tabelle hat Hash und Sortierschlüssel. Die folgenden Parameter funktionieren für mich.

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)); 
    } 
}); 

Bitte versuchen Sie die unten für Ihr Szenario.

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