title: How to update a nested object inside an array in DynamoDB
body: <p>Consider the following document item / syntax in a DynamoDB table:</p>
  
  <pre><code>{
      "id": "0f00b15e-83ee-4340-99ea-6cb890830d96",
      "name": "region-1",
      "controllers": [
          {
              "id": "93014cf0-bb05-4fbb-9466-d56ff51b1d22",
              "routes": [
                  {
                      "direction": "N",
                      "cars": 0,
                      "sensors": [
                          {
                              "id": "e82c45a3-d356-41e4-977e-f7ec947aad46",
                              "light": true,
                          },
                          {
                              "id": "78a6883e-1ced-4727-9c94-2154e0eb6139",
                          }
                      ]
                  }
              ]
          }
      ]
  }
  </code></pre>
  
  <p>My goal is to update a single attribute in this JSON representation, in this case <strong>cars</strong>.</p>
  
  <h1>My approach</h1>
  
  <p>I know all the sensors IDs. So, the easiest way to reach that attribute is to find, in the array, the <strong>route which has a sensor with any of the ids</strong>. Having found that sensor, Dynamo should know which object in the routes array he has to update. However, I cannot run this code without my condition being rejected.</p>
  
  <p>In this case, update attribute cars, where the route has a sensor with id <code>e82c45a3-d356-41e4-977e-f7ec947aad46</code> or <code>78a6883e-1ced-4727-9c94-2154e0eb6139</code>.</p>
  
  <pre><code>var params = {
      TableName: table,
      Key:{
          "id": "0f00b15e-83ee-4340-99ea-6cb890830d96",
          "name": "region-1"
      },
      UpdateExpression: "set controllers.intersections.routes.cars = :c",
      ConditionExpression: ""controllers.intersections.routes.sensors.id = :s",
      ExpressionAttributeValues:{
      ":c": 1,
      ":s": "e82c45a3-d356-41e4-977e-f7ec947aad46"
      },
      ReturnValues:"UPDATED_NEW"
  };
  
  docClient.update(params, ...); 
  </code></pre>
  
  <p>How can I achieve this?</p>