title: Mongo DB update nested object using Mongo C# Driver
body: <p>I'm not familiar with mongodb a lot and I like the document oriented databases. My application have these business entity classes:</p>
  
  <pre><code>public class ItemCategory
  {
      [BsonRepresentation(BsonType.ObjectId)]
      public string Id { get; set; }
      public string CategoryName { get; set; }
      public IList&lt;Item&gt; Items { get; set; }
  }
  
  public class Item
  {
      [BsonRepresentation(BsonType.ObjectId)]
      public string Id { get; set; }
      public string ItemName { get; set; }
  
      [BsonRepresentation(BsonType.Double)]
      public decimal UnitPrice { get; set; }
  }
  </code></pre>
  
  <p>This is my Context class</p>
  
  <pre><code>public class MongoDbContext
  {
      private MongoDatabase database;
  
      public MongoDatabase Database
      {
          get { return database; }
          set { database = value; }
      }
  
      public MongoDbContext()
      {
          var client = new MongoClient(Settings.Default.constr);
          var server = client.GetServer();
          Database= server.GetDatabase(Settings.Default.db);            
      }
  
      public MongoCollection&lt;ItemCategory&gt; ItemCategories 
      { 
          get
          {
              return Database.GetCollection&lt;ItemCategory&gt;("itemcategories"); 
          }
      }
  }
  </code></pre>
  
  <p>When I want to update a specific "Item" entity by Id which is nested inside "ItemCategory" entity, how should I do it. </p>