I have a C# class with some fields and some of them are null. Those that are null I do not want to be inserted into db with null value. I do not want them inserted into db a
Using the aptly named [BsonIgnoreIfNull] attribute:
class User { public string FirstName; public string LastName; [BsonIgnoreIfNull] public string MidName; }