I have an object
{
\"_id\": \"testobject\",
\"A\": \"First line\",
\"B\": \"Second line\",
\"C\": \"Third line\"
}
I want to send a RE
In ASP.net core 3.1 you can use the JsonPatchDocument and do a replace in mongodb
JsonPatch in ASP.NET Core web API
[HttpPatch]
public IActionResult JsonPatchWithModelState(
[FromBody] JsonPatchDocument patchDoc)
{
if (patchDoc != null)
{
var customer = CreateCustomer();
patchDoc.ApplyTo(customer, ModelState);
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
return new ObjectResult(customer);
}
else
{
return BadRequest(ModelState);
}
}