[BsonDefaultValue(0)]
[BsonIgnoreIfDefault]
public long TotalItems { get; set; }
The attribute [BsonDefaultValue(0)] is preventing the complete document being inserted into the mongo whereas I just want to prevent storing TotalItems if its value is zero. If I don't use the attributes [BsonDefaultValue(0)], [BsonIgnoreIfDefault] the the document is inserted properly in the db with TotalItems is inserted in the document as "TotalItems" : NumberLong(0)" which I actually don't want to strore into db if its zero. My question why [BsonDefaultValue(0)], [BsonIgnoreIfDefault] attributes preventing the insertion of the complete document.
Note: I am able to use the above two attributes with properties of type int.