title: AWS DynamoDb DocumentClient - Creating a batchWrite from an array of Items - node.js
body: <p>I'm trying to perform a <code>batchWrite</code> operation using DynamoDB's <code>DocumentClient</code> from an array of items (JSON)</p>
  
  <p>This is my code:</p>
  
  <pre><code>var items = [];
  
  for (i = 0; i &lt; orders.length; i++) {
      var ord = orders[i]; //a simple json object
      var item = { 
          'PutRequest': { 
              'Item' : ord[i] 
          } 
      };
  
      items.push(item);
   }
  
  
  var params = {
      RequestItems: {
          'my_table_name': items
      }
  };
  
  var docClient = new AWS.DynamoDB.DocumentClient();
  
  docClient.batchWrite(params, function(err, data) {
  
      if (err) {
          console.log('There was a problem putting the items in the table');
          context.fail(err);
      } 
      else {
          console.log('Items updated in table');
          context.done();
      }
  });
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <pre><code>{"errorMessage":"Missing required key 'Item' in        
   params.RequestItems['my_table_name']
   [0].PutRequest","errorType":"MissingRequiredParameter"...
  </code></pre>
  
  <p>I have looked at the <a href="http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#batchWrite-property" rel="noreferrer">documentation</a> but I can't understand what I 
  am doing wrong.</p>