title: Update value in array of string on array of objects mongodb
body: <p>I'm trying to update a value of a array of strings in mongodb, which is inside of another array of objects</p>
  
  <p>here is an example of the model</p>
  
  <pre><code>{ 
      "_id" : ObjectId("5a8cd02f87d4839d279f6559"), 
      "category" : "0",
      "email" : "doctor@doctor.com",
      "password" : "doctor",
      "name" : "doctor",
      "directorys" : [ { 
                         "path" : "doctor@doctor.com/own/", 
                         "files" : [ "" ] 
                       }, 
                       {
                         "path" : "doctor@doctor.com/modified/",
                         "files" : [ "" ] 
                       },
                       { 
                        "path" : "doctor@doctor.com/own/pacient1", 
                        "files" : [ "", "README.txt" ] 
                       } 
                     ] }
  }
  </code></pre>
  
  <p><strong>So im trying to update the name "README.txt" to "README2.txt" but i'm struggling with mongo</strong></p>
  
  <p>i tried this</p>
  
  <pre><code>db.users.update({"email":"doctor@doctor.com","directorys.files":"README.txt"},{"$set":{"directorys.files.$":"README2.txt"}})
  </code></pre>
  
  <p>but throws the following error</p>
  
  <pre><code>WriteResult({
      "nMatched" : 0,
      "nUpserted" : 0,
      "nModified" : 0,
      "writeError" : {
          "code" : 16837,
          "errmsg" : "cannot use the part (directorys of directorys.files.2) to traverse the element ({directorys: [ { path: \"doctor@doctor.com/own/\", files: [ \"\" ] }, { path: \"doctor@doctor.com/modified/\", files: [ \"\" ] }, { path: \"doctor@doctor.com/own/pacient1\", files: [ \"\", \"README.txt\" ] } ]})"
      }
  })
  </code></pre>
  
  <p>what i am missing? i dont know what to do</p>