updated model creation to recognize ObjectId fields and load the needed type