I am new to MongoDb, we are using it in a .netCore application. The issue I am facing is to manage changes in our schema. If we have additional fields in our DB collection which are not present in our DB model in our code, can we force MongoDB to ignore these additional fields and work with the fields which are present in model only?
For Example My data in DB is :
"Name" : {
"FamilyName" : "Athanasoulas",
"FirstName" : "Stephanie",
"MiddleName" : null,
"Prefix" : null,
"Suffix" : null
}
And my DB model is short of some fields
Name
{
public string FamilyName{ get; set; }
public string FirstName{ get; set; }
}
How can we enforce MongoDB client to ignore those additional attribute which exist in DB (Prefix,Suffix) and work with only those fields which are in DataModel class?
I assume we have this flexibility with Mongo but Im not sure how to achieve that.