title: how to add an empty or data map in dynamodb?
body: <p>I have something like this:</p>
  
  <pre><code>{
    Records:{}
  }
  </code></pre>
  
  <p>and I just want to add data inside records like this:</p>
  
  <pre><code>{
    Id: 123,
    Records:{
      10001: { event : "item1" }
    }
  }
  </code></pre>
  
  <p>My 1st attempt:</p>
  
  <pre><code>var params = {
      TableName : "Records",
      Key : { Id : 123 },
      UpdateExpression: 'set Record.#k1.event = :v1',
      ExpressionAttributeNames: { '#k1' :  10001},
      ExpressionAttributeValues: { ':v1' : 'item1' }
  };
  </code></pre>
  
  <p>Because Record.10001 doesn't exist, it give me error:</p>
  
  <pre><code>The document path provided in the update expression is invalid for update
  </code></pre>
  
  <p>"ADD" only support NUMBER and SET type so its not suitable in my case.</p>
  
  <p>My 2nd attempt (trying to create a empty map 1st):</p>
  
  <pre><code>var params = {
      TableName : "Records",
      Key : { Id : 123 },
      UpdateExpression: 'set Record.#k1 = {}',
      ExpressionAttributeNames: { '#k1' :  10001},
  };
  </code></pre>
  
  <p>It fails as my syntax is probably incorrect and I cannot find how to create a empty map to an attribute.</p>
  
  <p>So my question is how do I add structured object as a map or empty map to an existing item like the example above? </p>
  
  <p>I can easily modifying the data from the amazon DynamoDB data management page so at least I know there exist a way to do it. I just need to know how.</p>
  
  <p>Thanks</p>