title: MongoDB updating fields in nested array
body: <p>MongoDB updating fields in nested array</p>
  <p>How can I set &quot;play&quot; to &quot;play photo&quot; in the <code>photos</code> array?</p>
  <p>I only know its <code>_id</code>.</p>
  <pre><code>&quot;_id&quot;: ObjectId(&quot;4f41a5c7c32810e404000000&quot;),
  &quot;albums&quot;: [
  {
      &quot;_id&quot;: ObjectId(&quot;4f545d1bc328103812000000&quot;),
      &quot;name&quot;: &quot;album1&quot; ,
      &quot;photos&quot;:[{
          &quot;_id&quot;: ObjectId(&quot;4f545d1bc328103812d00000&quot;),
          &quot;name&quot;:&quot;travel photo&quot;
      },{
          &quot;_id&quot;: ObjectId(&quot;4f545d1bc328103812c00000&quot;),
          &quot;name&quot;:&quot;play&quot;
      }]
  },
  {
      &quot;_id&quot;: ObjectId(&quot;4f545f56c328103c12000000&quot;),
      &quot;name&quot;: &quot;album2&quot; 
  },
  {
      &quot;_id&quot;: ObjectId(&quot;4f545f68c328103012000000&quot;),
      &quot;name&quot;: &quot;album3&quot; 
  },
  {
      &quot;_id&quot;: ObjectId(&quot;4f546642c328103c12000001&quot;),
      &quot;name&quot;: &quot;album4&quot; 
  }]
  </code></pre>