title: How to update all document fields except specified ones in mongodb
body: <p>I present a simple model:</p>
  
  <pre><code>public class UserDocument
  {
      [BsonRepresentation(BsonType.ObjectId)]
      public string Id { get; set; }
  
      public string DisplayName { get; set; }
  
      public List&lt;string&gt; Friends { get; set; }
  }
  </code></pre>
  
  <p>I am using the latest C# driver which has the ability to replace a document using a C# object which will automatically update <em>all its fields</em>. Problem is I want to update <em>all fields except for the user friends</em>, because it's a field containing the object relations to other documents. Of course I can manually update each field of the ones I want to get updated, which here are just two.</p>
  
  <p>But this example is simple just to make my point. In reality the fields are much more and it would be harder to update each field. That would require a single line for each one to use the <code>Set</code> operator. Also, newly-added fields would have to be supported in the same way as opposed to updating to automatically just works.</p>
  
  <p>Is there a way to achieve that - automatically update all fields with just specifying a list of excluded fields?</p>