I am using the Official MongoDB C# Drive v0.9.1.26831, but I was wondering given a POCO class, is there anyway to ignore certain properties from getting inserted.
For ex
Also you can make IsOwner
Nullable and add [BsonIgnoreExtraElements]
to the whole class:
[BsonIgnoreExtraElements]
public class GroceryList : MongoEntity
{
public FacebookList Owner { get; set; }
public bool? IsOwner { get; set; }
}
A property with null
value will be ignored during serialization.
But I think [BsonIgnore]
will be better for your case.