I want only items in list entityParameters will update in x.Params
by Id , update all items of entityParameters if entityParameters.Id == x.Params.Id
List<Param> entityParameters
filter = Builders<MachineObj>.Filter.Where(x => x.MachineId == id);
update = Builders<MachineObj>.Update
.Set(x => x.Params, entityParameters);
2
Answers
Here is an approach to update only the items in x.Params that match the Id of items in entityParameters, using the MongoDB C# driver. This involves iterating over entityParameters and creating update definitions for each item: