How should I go about storing GeoJson using C# MongoDB driver that is coming to Web API endpoint? Preferably I would like to do something like this:
Model:
class House
{
...
public GeoJsonPoint<GeoJson2DGeographicCoordinates> Location { get; set; }
}
Endpoint:
class HouseController
{
[HttpPut]
SaveHouse([FromBody] House house)
{
db.GetCollection<House>("houses").UpdateOne(house);
}
}
problem is that the property Location is null in FromBody parameter. Newtonsoft Json.net is used for Json deserialization. The GeoJson coming from client should be valid, since it is coming straight from Mapbox draw functionality. There may be syntax errors in code. it is simplified, made up example.