Mongo version 1.8.2.
Assume I have a class like
public class Acc
{
public int _id { get; set; }
public int? Foo { get; set; }
public int? Bar{ get; set; }
}
Acc a = new Acc
{
_id = 1,
Foo = 3
};
I'd like to call
myCollection.Save(a),
such that
- if it doesn't exist, its inserted (easy so far)
- if it does exist, Foo is updated, but, but Bar remains whatever it currently is (perhaps non-null...)
How do I achieve this partial upsert?
Many thanks.