title: Update property in nested array of entities in MongoDB
body: <p>Is there a straight forward way to update nested array of entities in MongoDB. I am using <code>MongoDB C# Driver</code> for making the DB call from application. Below is an exmaple : say I have a <code>Student</code> collection where each document has a nested array of <code>Course</code> with some necessary fields populated and <code>Course</code> by itself is a separate collection like:</p>
  
  <pre><code>{
   "_id": "234dssfcv456",
   "Name": "Jean Douglas",
   "Age": 32,
   "Courses": 
    [
      {
         "_id": "1234",
         "Name": "Computer Science",
         "Level": "Basic" 
      },
      {
         "_id": "3456",
         "Name": "Bio Science",
         "Level": "Intermediate" 
      }
    ] 
  }
  </code></pre>
  
  <p>I know I can update the nested entity by index something like below but I don't know the index and rather know only the nested <code>Course</code> object <code>Id</code> only.</p>
  
  <pre><code>db.College.Student.update(
      {"Student._id": "234dssfcv456"}, 
      {$set: {
          "Student.$.Courses.1.Level": "Basic"
      }}
  </code></pre>
  
  <p>Right now, am reading the entire nested array of courses -> doing the modification at application end -> then passing the entire array for update with the filedname <code>"Courses"</code> which is going to replace the existing array with the one passed.</p>
  
  <p>But was thinking, is there an way I can update one entity in array with the <code>Id</code> available. Please suggest.</p>
  
  <p>*** On the right side in <em>Related</em> question section all shows updating the nested array of objects using the <em>index</em> of the object item which is not a possibility for me.</p>