I am using Mongodb C# official driver. I want to change a particular value in an array with some other value. The array contains list of values. For eg.
{
_id: id1,
values: [23, 78, 20]
}
I want suppose to replace 23 by 25. I know one answer if it is right. First I pull that element and then push other. But the problem is that if the element is not present then also push will insert the element. Secondly, it will change the position and insert the element at the end. Please tell me how to do it.