static Repository() { var mapper = new CustomMapper(); mapper.Entity <DefaultFoodUnit>().DbRef(x => x.FoodUnit).Ignore(x => x.NutrientsPer1G).Ignore(x => x.NutrientsPer100G); mapper.Entity <Food>().DbRef(x => x.Units); mapper.Entity <MealFood>().DbRef(x => x.Food).DbRef(x => x.FoodUnit).Ignore(x => x.Nutrients); mapper.Entity <MealTemplate>().Ignore(x => x.Nutrients); mapper.Entity <EatingDay>().Ignore(x => x.Nutrients); mapper.Entity <Macros>() .Ignore(x => x.Calories) .Ignore(x => x.CarbsPercentage) .Ignore(x => x.ProteinPercentage) .Ignore(x => x.FatsPercentage) .Ignore(x => x.AlcoholPercentage); BsonMapper.Global = mapper; }