MongoDB C# Driver: Ignore Property on Insert
It looks like the [BsonIgnore] attribute did the job.
public class GroceryList : MongoEntity<ObjectId>
{
public FacebookList Owner { get; set; }
[BsonIgnore]
public bool IsOwner { get; set; }
}
Alternatively, if you don't want to use the attribute for some reason (e. g. in case you don't want to bring an extra dependency to MongoDB.Bson
to your DTO), you can do the following:
BsonClassMap.RegisterClassMap<GroceryList>(cm =>
{
cm.AutoMap();
cm.UnmapMember(m => m.IsOwner);
});