title: How do I use batchWriteItem with Node.js to query AWS DynamoDB?
body: <p>I'm new to AWS and I'm having problems trying to develop a simple Lambda function with Node.js. In DynamoDB, I have a table named <code>Game</code> with 3 attributes: <code>gamepk</code>, <code>user</code>, <code>result</code>.
  In just one single execution of the Lambda function, I want to insert a collection of <code>game</code> elements (the number of elements in the collection could vary).
  I had been reading some tutorials and it said I should use <code>batchWriteItem</code>, but because the collection of Game elements is variable I don't know how to proceed.</p>
  <p>Could somebody write a function in Node.js that solves my problem?</p>
  <p>An example of the JSON that the lambda function receives is this one:</p>
  <pre class="lang-json prettyprint-override"><code>    {
          &quot;games&quot;: [{
                  &quot;gamepk&quot;: &quot;1&quot;,
                  &quot;user&quot;: &quot;rolo&quot;,
                  &quot;result&quot;: &quot;1-0&quot;
  
              },
              {
                  &quot;gamepk&quot;: &quot;2&quot;,
                  &quot;user&quot;: &quot;jhon&quot;,
                  &quot;result&quot;: &quot;1-1&quot;
              }
          ]
      }
  </code></pre>